Generator cleanup.
This commit is contained in:
parent
ee5d526d26
commit
a44bd85d32
22 changed files with 97 additions and 92 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# Jet Sql Builder for Postgresql(soon MySql and OracleSql)
|
||||
# Jet - Sql Builder for Postgresql
|
||||
|
||||
[](https://circleci.com/gh/go-jet/jet/tree/develop)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package main
|
|||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/generator"
|
||||
"github.com/go-jet/jet/generator/postgresgen"
|
||||
"os"
|
||||
)
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ func init() {
|
|||
|
||||
func main() {
|
||||
|
||||
genData := generator.GeneratorData{
|
||||
genData := postgresgen.DBConnection{
|
||||
Host: host,
|
||||
Port: port,
|
||||
User: user,
|
||||
|
|
@ -50,14 +50,10 @@ func main() {
|
|||
SchemaName: schemaName,
|
||||
}
|
||||
|
||||
fmt.Println(destDir, genData)
|
||||
|
||||
err := generator.Generate(destDir, genData)
|
||||
err := postgresgen.Generate(destDir, genData)
|
||||
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
os.Exit(-1)
|
||||
}
|
||||
|
||||
fmt.Println("SUCCESS")
|
||||
}
|
||||
|
|
@ -72,18 +72,18 @@ func (d *deleteStatementImpl) DebugSql() (query string, err error) {
|
|||
return DebugSql(d)
|
||||
}
|
||||
|
||||
func (d *deleteStatementImpl) Query(db execution.Db, destination interface{}) error {
|
||||
func (d *deleteStatementImpl) Query(db execution.DB, destination interface{}) error {
|
||||
return Query(d, db, destination)
|
||||
}
|
||||
|
||||
func (d *deleteStatementImpl) QueryContext(db execution.Db, context context.Context, destination interface{}) error {
|
||||
func (d *deleteStatementImpl) QueryContext(db execution.DB, context context.Context, destination interface{}) error {
|
||||
return QueryContext(d, db, context, destination)
|
||||
}
|
||||
|
||||
func (d *deleteStatementImpl) Exec(db execution.Db) (res sql.Result, err error) {
|
||||
func (d *deleteStatementImpl) Exec(db execution.DB) (res sql.Result, err error) {
|
||||
return Exec(d, db)
|
||||
}
|
||||
|
||||
func (d *deleteStatementImpl) ExecContext(db execution.Db, context context.Context) (res sql.Result, err error) {
|
||||
func (d *deleteStatementImpl) ExecContext(db execution.DB, context context.Context) (res sql.Result, err error) {
|
||||
return ExecContext(d, db, context)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
"database/sql"
|
||||
)
|
||||
|
||||
type Db interface {
|
||||
type DB interface {
|
||||
Exec(query string, args ...interface{}) (sql.Result, error)
|
||||
ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
|
||||
Query(query string, args ...interface{}) (*sql.Rows, error)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import (
|
|||
"database/sql/driver"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/execution/internal"
|
||||
"github.com/serenize/snaker"
|
||||
"reflect"
|
||||
"strconv"
|
||||
|
|
@ -13,7 +14,7 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
func Query(db Db, context context.Context, query string, args []interface{}, destinationPtr interface{}) error {
|
||||
func Query(db DB, context context.Context, query string, args []interface{}, destinationPtr interface{}) error {
|
||||
|
||||
if destinationPtr == nil {
|
||||
return errors.New("Destination is nil. ")
|
||||
|
|
@ -54,7 +55,7 @@ func Query(db Db, context context.Context, query string, args []interface{}, des
|
|||
}
|
||||
}
|
||||
|
||||
func queryToSlice(db Db, ctx context.Context, query string, args []interface{}, slicePtr interface{}) error {
|
||||
func queryToSlice(db DB, ctx context.Context, query string, args []interface{}, slicePtr interface{}) error {
|
||||
if db == nil {
|
||||
return errors.New("db is nil")
|
||||
}
|
||||
|
|
@ -494,15 +495,15 @@ func createScanValue(columnTypes []*sql.ColumnType) []interface{} {
|
|||
return values
|
||||
}
|
||||
|
||||
var nullFloatType = reflect.TypeOf(NullFloat32{})
|
||||
var nullFloatType = reflect.TypeOf(internal.NullFloat32{})
|
||||
var nullFloat64Type = reflect.TypeOf(sql.NullFloat64{})
|
||||
var nullInt16Type = reflect.TypeOf(NullInt16{})
|
||||
var nullInt32Type = reflect.TypeOf(NullInt32{})
|
||||
var nullInt16Type = reflect.TypeOf(internal.NullInt16{})
|
||||
var nullInt32Type = reflect.TypeOf(internal.NullInt32{})
|
||||
var nullInt64Type = reflect.TypeOf(sql.NullInt64{})
|
||||
var nullStringType = reflect.TypeOf(sql.NullString{})
|
||||
var nullBoolType = reflect.TypeOf(sql.NullBool{})
|
||||
var nullTimeType = reflect.TypeOf(NullTime{})
|
||||
var nullByteArrayType = reflect.TypeOf(NullByteArray{})
|
||||
var nullTimeType = reflect.TypeOf(internal.NullTime{})
|
||||
var nullByteArrayType = reflect.TypeOf(internal.NullByteArray{})
|
||||
|
||||
func newScanType(columnType *sql.ColumnType) reflect.Type {
|
||||
switch columnType.DatabaseTypeName() {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package execution
|
||||
package internal
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
|
|
@ -2,8 +2,7 @@ package postgres_metadata
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/generator/metadata"
|
||||
"github.com/go-jet/jet/generator/internal/metadata"
|
||||
)
|
||||
|
||||
type EnumInfo struct {
|
||||
|
|
@ -63,7 +62,5 @@ ORDER BY n.nspname, t.typname, e.enumsortorder;`
|
|||
})
|
||||
}
|
||||
|
||||
fmt.Println("FOUND", len(ret), " enums")
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
|
|
@ -2,8 +2,7 @@ package postgres_metadata
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/generator/metadata"
|
||||
"github.com/go-jet/jet/generator/internal/metadata"
|
||||
)
|
||||
|
||||
type SchemaInfo struct {
|
||||
|
|
@ -65,8 +64,6 @@ where table_catalog = $1 and table_schema = $2 and table_type = 'BASE TABLE';
|
|||
ret = append(ret, tableInfo)
|
||||
}
|
||||
|
||||
fmt.Println("FOUND", len(ret), "tables")
|
||||
|
||||
err = rows.Err()
|
||||
|
||||
if err != nil {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package generator
|
||||
package utils
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
|
@ -11,7 +11,7 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
func saveGoFile(dirPath, fileName string, text []byte) error {
|
||||
func SaveGoFile(dirPath, fileName string, text []byte) error {
|
||||
newGoFilePath := filepath.Join(dirPath, fileName) + ".go"
|
||||
|
||||
file, err := os.Create(newGoFilePath)
|
||||
|
|
@ -36,7 +36,7 @@ func saveGoFile(dirPath, fileName string, text []byte) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func ensureDirPath(dirPath string) error {
|
||||
func EnsureDirPath(dirPath string) error {
|
||||
if _, err := os.Stat(dirPath); os.IsNotExist(err) {
|
||||
err := os.MkdirAll(dirPath, os.ModePerm)
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ func ensureDirPath(dirPath string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func generateTemplate(templateText string, templateData interface{}) ([]byte, error) {
|
||||
func GenerateTemplate(templateText string, templateData interface{}) ([]byte, error) {
|
||||
|
||||
t, err := template.New("sqlBuilderTableTemplate").Funcs(template.FuncMap{
|
||||
"camelize": func(txt string) string {
|
||||
|
|
@ -71,8 +71,8 @@ func generateTemplate(templateText string, templateData interface{}) ([]byte, er
|
|||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
func cleanUpGeneratedFiles(dir string) error {
|
||||
exist, err := dirExists(dir)
|
||||
func CleanUpGeneratedFiles(dir string) error {
|
||||
exist, err := DirExists(dir)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -89,7 +89,7 @@ func cleanUpGeneratedFiles(dir string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func dirExists(path string) (bool, error) {
|
||||
func DirExists(path string) (bool, error) {
|
||||
_, err := os.Stat(path)
|
||||
if err == nil {
|
||||
return true, nil
|
||||
|
|
@ -1,16 +1,17 @@
|
|||
package generator
|
||||
package postgresgen
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/generator/metadata"
|
||||
"github.com/go-jet/jet/generator/postgres-metadata"
|
||||
"github.com/go-jet/jet/generator/internal/metadata"
|
||||
"github.com/go-jet/jet/generator/internal/metadata/postgres-metadata"
|
||||
"github.com/go-jet/jet/generator/internal/utils"
|
||||
_ "github.com/lib/pq"
|
||||
"path"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
type GeneratorData struct {
|
||||
type DBConnection struct {
|
||||
Host string
|
||||
Port string
|
||||
User string
|
||||
|
|
@ -22,11 +23,13 @@ type GeneratorData struct {
|
|||
SchemaName string
|
||||
}
|
||||
|
||||
func Generate(destDir string, genData GeneratorData) error {
|
||||
func Generate(destDir string, genData DBConnection) error {
|
||||
|
||||
connectionString := fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=%s %s",
|
||||
genData.Host, genData.Port, genData.User, genData.Password, genData.DBName, genData.SslMode, genData.Params)
|
||||
|
||||
fmt.Println("Connecting to postgres database: " + connectionString)
|
||||
|
||||
db, err := sql.Open("postgres", connectionString)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -39,69 +42,80 @@ func Generate(destDir string, genData GeneratorData) error {
|
|||
return err
|
||||
}
|
||||
|
||||
err = cleanUpGeneratedFiles(path.Join(destDir, genData.DBName, genData.SchemaName))
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Println("Retrieving schema information...")
|
||||
schemaInfo, err := postgres_metadata.GetSchemaInfo(db, genData.DBName, genData.SchemaName)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Println(" FOUND", len(schemaInfo.TableInfos), " table(s), ", len(schemaInfo.EnumInfos), " enum(s)")
|
||||
|
||||
fmt.Println("Cleaning up destination directory...")
|
||||
err = utils.CleanUpGeneratedFiles(path.Join(destDir, genData.DBName, genData.SchemaName))
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Println("Generating table sql builder files...")
|
||||
err = generate(schemaInfo, destDir, "table", sqlBuilderTableTemplate, schemaInfo.TableInfos)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
//err = generateDataModel(schemaInfo, destDir)
|
||||
fmt.Println("Generating table model files...")
|
||||
err = generate(schemaInfo, destDir, "model", dataModelTemplate, schemaInfo.TableInfos)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = generate(schemaInfo, destDir, "model", enumModelTemplate, schemaInfo.EnumInfos)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(schemaInfo.EnumInfos) > 0 {
|
||||
fmt.Println("Generating enum sql builder files...")
|
||||
err = generate(schemaInfo, destDir, "enum", enumTypeTemplate, schemaInfo.EnumInfos)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Println("Generating enum model files...")
|
||||
err = generate(schemaInfo, destDir, "model", enumModelTemplate, schemaInfo.EnumInfos)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println("Done")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func generate(schemaInfo postgres_metadata.SchemaInfo, dirPath, packageName string, template string, metaDataList []metadata.MetaData) error {
|
||||
modelDirPath := filepath.Join(dirPath, schemaInfo.DatabaseName, schemaInfo.Name, packageName)
|
||||
|
||||
err := ensureDirPath(modelDirPath)
|
||||
err := utils.EnsureDirPath(modelDirPath)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
autoGenWarning, err := generateTemplate(autoGenWarningTemplate, nil)
|
||||
autoGenWarning, err := utils.GenerateTemplate(autoGenWarningTemplate, nil)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, metaData := range metaDataList {
|
||||
text, err := generateTemplate(template, metaData)
|
||||
text, err := utils.GenerateTemplate(template, metaData)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = saveGoFile(modelDirPath, metaData.Name(), append(autoGenWarning, text...))
|
||||
err = utils.SaveGoFile(modelDirPath, metaData.Name(), append(autoGenWarning, text...))
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package generator
|
||||
package postgresgen
|
||||
|
||||
var autoGenWarningTemplate = `
|
||||
//
|
||||
|
|
@ -146,18 +146,18 @@ func (i *insertStatementImpl) Sql() (sql string, args []interface{}, err error)
|
|||
return
|
||||
}
|
||||
|
||||
func (i *insertStatementImpl) Query(db execution.Db, destination interface{}) error {
|
||||
func (i *insertStatementImpl) Query(db execution.DB, destination interface{}) error {
|
||||
return Query(i, db, destination)
|
||||
}
|
||||
|
||||
func (i *insertStatementImpl) QueryContext(db execution.Db, context context.Context, destination interface{}) error {
|
||||
func (i *insertStatementImpl) QueryContext(db execution.DB, context context.Context, destination interface{}) error {
|
||||
return QueryContext(i, db, context, destination)
|
||||
}
|
||||
|
||||
func (i *insertStatementImpl) Exec(db execution.Db) (res sql.Result, err error) {
|
||||
func (i *insertStatementImpl) Exec(db execution.DB) (res sql.Result, err error) {
|
||||
return Exec(i, db)
|
||||
}
|
||||
|
||||
func (i *insertStatementImpl) ExecContext(db execution.Db, context context.Context) (res sql.Result, err error) {
|
||||
func (i *insertStatementImpl) ExecContext(db execution.DB, context context.Context) (res sql.Result, err error) {
|
||||
return ExecContext(i, db, context)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,18 +93,18 @@ func (l *lockStatementImpl) Sql() (query string, args []interface{}, err error)
|
|||
return
|
||||
}
|
||||
|
||||
func (l *lockStatementImpl) Query(db execution.Db, destination interface{}) error {
|
||||
func (l *lockStatementImpl) Query(db execution.DB, destination interface{}) error {
|
||||
return Query(l, db, destination)
|
||||
}
|
||||
|
||||
func (l *lockStatementImpl) QueryContext(db execution.Db, context context.Context, destination interface{}) error {
|
||||
func (l *lockStatementImpl) QueryContext(db execution.DB, context context.Context, destination interface{}) error {
|
||||
return QueryContext(l, db, context, destination)
|
||||
}
|
||||
|
||||
func (l *lockStatementImpl) Exec(db execution.Db) (sql.Result, error) {
|
||||
func (l *lockStatementImpl) Exec(db execution.DB) (sql.Result, error) {
|
||||
return Exec(l, db)
|
||||
}
|
||||
|
||||
func (l *lockStatementImpl) ExecContext(db execution.Db, context context.Context) (res sql.Result, err error) {
|
||||
func (l *lockStatementImpl) ExecContext(db execution.DB, context context.Context) (res sql.Result, err error) {
|
||||
return ExecContext(l, db, context)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -289,18 +289,18 @@ func (s *selectLockImpl) serialize(statement statementType, out *queryData, opti
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *selectStatementImpl) Query(db execution.Db, destination interface{}) error {
|
||||
func (s *selectStatementImpl) Query(db execution.DB, destination interface{}) error {
|
||||
return Query(s, db, destination)
|
||||
}
|
||||
|
||||
func (s *selectStatementImpl) QueryContext(db execution.Db, context context.Context, destination interface{}) error {
|
||||
func (s *selectStatementImpl) QueryContext(db execution.DB, context context.Context, destination interface{}) error {
|
||||
return QueryContext(s, db, context, destination)
|
||||
}
|
||||
|
||||
func (s *selectStatementImpl) Exec(db execution.Db) (res sql.Result, err error) {
|
||||
func (s *selectStatementImpl) Exec(db execution.DB) (res sql.Result, err error) {
|
||||
return Exec(s, db)
|
||||
}
|
||||
|
||||
func (s *selectStatementImpl) ExecContext(db execution.Db, context context.Context) (res sql.Result, err error) {
|
||||
func (s *selectStatementImpl) ExecContext(db execution.DB, context context.Context) (res sql.Result, err error) {
|
||||
return ExecContext(s, db, context)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,18 +203,18 @@ func (s *setStatementImpl) DebugSql() (query string, err error) {
|
|||
return DebugSql(s)
|
||||
}
|
||||
|
||||
func (s *setStatementImpl) Query(db execution.Db, destination interface{}) error {
|
||||
func (s *setStatementImpl) Query(db execution.DB, destination interface{}) error {
|
||||
return Query(s, db, destination)
|
||||
}
|
||||
|
||||
func (s *setStatementImpl) QueryContext(db execution.Db, context context.Context, destination interface{}) error {
|
||||
func (s *setStatementImpl) QueryContext(db execution.DB, context context.Context, destination interface{}) error {
|
||||
return QueryContext(s, db, context, destination)
|
||||
}
|
||||
|
||||
func (s *setStatementImpl) Exec(db execution.Db) (res sql.Result, err error) {
|
||||
func (s *setStatementImpl) Exec(db execution.DB) (res sql.Result, err error) {
|
||||
return Exec(s, db)
|
||||
}
|
||||
|
||||
func (s *setStatementImpl) ExecContext(db execution.Db, context context.Context) (res sql.Result, err error) {
|
||||
func (s *setStatementImpl) ExecContext(db execution.DB, context context.Context) (res sql.Result, err error) {
|
||||
return ExecContext(s, db, context)
|
||||
}
|
||||
|
|
|
|||
16
statement.go
16
statement.go
|
|
@ -14,11 +14,11 @@ type Statement interface {
|
|||
|
||||
DebugSql() (query string, err error)
|
||||
|
||||
Query(db execution.Db, destination interface{}) error
|
||||
QueryContext(db execution.Db, context context.Context, destination interface{}) error
|
||||
Query(db execution.DB, destination interface{}) error
|
||||
QueryContext(db execution.DB, context context.Context, destination interface{}) error
|
||||
|
||||
Exec(db execution.Db) (sql.Result, error)
|
||||
ExecContext(db execution.Db, context context.Context) (sql.Result, error)
|
||||
Exec(db execution.DB) (sql.Result, error)
|
||||
ExecContext(db execution.DB, context context.Context) (sql.Result, error)
|
||||
}
|
||||
|
||||
func DebugSql(statement Statement) (string, error) {
|
||||
|
|
@ -38,7 +38,7 @@ func DebugSql(statement Statement) (string, error) {
|
|||
return debugSqlQuery, nil
|
||||
}
|
||||
|
||||
func Query(statement Statement, db execution.Db, destination interface{}) error {
|
||||
func Query(statement Statement, db execution.DB, destination interface{}) error {
|
||||
query, args, err := statement.Sql()
|
||||
|
||||
if err != nil {
|
||||
|
|
@ -48,7 +48,7 @@ func Query(statement Statement, db execution.Db, destination interface{}) error
|
|||
return execution.Query(db, context.Background(), query, args, destination)
|
||||
}
|
||||
|
||||
func QueryContext(statement Statement, db execution.Db, context context.Context, destination interface{}) error {
|
||||
func QueryContext(statement Statement, db execution.DB, context context.Context, destination interface{}) error {
|
||||
query, args, err := statement.Sql()
|
||||
|
||||
if err != nil {
|
||||
|
|
@ -58,7 +58,7 @@ func QueryContext(statement Statement, db execution.Db, context context.Context,
|
|||
return execution.Query(db, context, query, args, destination)
|
||||
}
|
||||
|
||||
func Exec(statement Statement, db execution.Db) (res sql.Result, err error) {
|
||||
func Exec(statement Statement, db execution.DB) (res sql.Result, err error) {
|
||||
query, args, err := statement.Sql()
|
||||
|
||||
if err != nil {
|
||||
|
|
@ -68,7 +68,7 @@ func Exec(statement Statement, db execution.Db) (res sql.Result, err error) {
|
|||
return db.Exec(query, args...)
|
||||
}
|
||||
|
||||
func ExecContext(statement Statement, db execution.Db, context context.Context) (res sql.Result, err error) {
|
||||
func ExecContext(statement Statement, db execution.DB, context context.Context) (res sql.Result, err error) {
|
||||
query, args, err := statement.Sql()
|
||||
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ func TestJoinEverything(t *testing.T) {
|
|||
Customer struct { // customer data for invoice
|
||||
model.Customer
|
||||
|
||||
Employee *struct {
|
||||
Employee *struct { // employee data for customer if exists
|
||||
model.Employee
|
||||
|
||||
Manager *model.Employee
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package main
|
|||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/generator"
|
||||
postgres_generator "github.com/go-jet/jet/generator/postgresgen"
|
||||
"github.com/go-jet/jet/tests/dbconfig"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
|
@ -33,7 +33,7 @@ func main() {
|
|||
|
||||
_, err = db.Exec(string(testSampleSql))
|
||||
|
||||
err = generator.Generate("./.test_files", generator.GeneratorData{
|
||||
err = postgres_generator.Generate("./.test_files", postgres_generator.DBConnection{
|
||||
Host: dbconfig.Host,
|
||||
Port: "5432",
|
||||
User: dbconfig.User,
|
||||
|
|
|
|||
|
|
@ -139,18 +139,18 @@ func (u *updateStatementImpl) DebugSql() (query string, err error) {
|
|||
return DebugSql(u)
|
||||
}
|
||||
|
||||
func (u *updateStatementImpl) Query(db execution.Db, destination interface{}) error {
|
||||
func (u *updateStatementImpl) Query(db execution.DB, destination interface{}) error {
|
||||
return Query(u, db, destination)
|
||||
}
|
||||
|
||||
func (u *updateStatementImpl) QueryContext(db execution.Db, context context.Context, destination interface{}) error {
|
||||
func (u *updateStatementImpl) QueryContext(db execution.DB, context context.Context, destination interface{}) error {
|
||||
return QueryContext(u, db, context, destination)
|
||||
}
|
||||
|
||||
func (u *updateStatementImpl) Exec(db execution.Db) (res sql.Result, err error) {
|
||||
func (u *updateStatementImpl) Exec(db execution.DB) (res sql.Result, err error) {
|
||||
return Exec(u, db)
|
||||
}
|
||||
|
||||
func (u *updateStatementImpl) ExecContext(db execution.Db, context context.Context) (res sql.Result, err error) {
|
||||
func (u *updateStatementImpl) ExecContext(db execution.DB, context context.Context) (res sql.Result, err error) {
|
||||
return ExecContext(u, db, context)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue