-
Notifications
You must be signed in to change notification settings - Fork 777
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
31 changed files
with
386 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,41 @@ | ||
package golang | ||
|
||
import ( | ||
"github.com/kyleconroy/sqlc/internal/plugin" | ||
) | ||
|
||
type SQLDriver int | ||
|
||
const ( | ||
SQLPackagePGXV4 string = "pgx/v4" | ||
SQLPackagePGXV5 string = "pgx/v5" | ||
SQLPackageStandard string = "database/sql" | ||
) | ||
|
||
const ( | ||
SQLDriverPGXV4 SQLDriver = iota | ||
SQLDriverPGXV5 | ||
SQLDriverLibPQ | ||
) | ||
|
||
func parseDriver(settings *plugin.Settings) SQLDriver { | ||
if settings.Go.SqlPackage == "pgx/v4" { | ||
func parseDriver(sqlPackage string) SQLDriver { | ||
switch sqlPackage { | ||
case SQLPackagePGXV4: | ||
return SQLDriverPGXV4 | ||
} else { | ||
case SQLPackagePGXV5: | ||
return SQLDriverPGXV5 | ||
default: | ||
return SQLDriverLibPQ | ||
} | ||
} | ||
|
||
func (d SQLDriver) IsPGX() bool { | ||
return d == SQLDriverPGXV4 || d == SQLDriverPGXV5 | ||
} | ||
|
||
func (d SQLDriver) Package() string { | ||
switch d { | ||
case SQLDriverPGXV4: | ||
return SQLPackagePGXV4 | ||
case SQLDriverPGXV5: | ||
return SQLPackagePGXV5 | ||
default: | ||
return SQLPackageStandard | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.