-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathdriver.go
More file actions
29 lines (26 loc) · 825 Bytes
/
driver.go
File metadata and controls
29 lines (26 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package golang
import "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts"
func parseDriver(sqlPackage string) opts.SQLDriver {
switch sqlPackage {
case opts.SQLPackagePGXV4:
return opts.SQLDriverPGXV4
case opts.SQLPackagePGXV5:
return opts.SQLDriverPGXV5
case opts.SQLPackageYugaBytePGXV5:
return opts.SQLDriverYugaBytePGXV5
default:
return opts.SQLDriverLibPQ
}
}
// custom packages based on pgx/v5 (e.g., YugabyteDB smart drivers) should return
// only the original driver when determining columnType, refer to the postgresType func.
func parseDriverPGType(sqlPackage string) opts.SQLDriver {
switch sqlPackage {
case opts.SQLPackagePGXV4:
return opts.SQLDriverPGXV4
case opts.SQLPackagePGXV5, opts.SQLPackageYugaBytePGXV5:
return opts.SQLDriverPGXV5
default:
return opts.SQLDriverLibPQ
}
}