Adding custom insertQuery support for postgres/2 mysql/2

This commit is contained in:
LazyDBA247-Anyvision
2021-03-29 09:58:13 +03:00
parent bd7471d877
commit 4a02389eb0
6 changed files with 27 additions and 7 deletions

View File

@@ -10,6 +10,7 @@ import (
type SqlGenPostgres struct {
CreateTableSqlTemplate string
DropTableSqlTemplate string
InsertQueryTemplate string
}
var (
@@ -17,7 +18,11 @@ var (
)
func (gen *SqlGenPostgres) GetSqlInsert(tableName string) string {
return fmt.Sprintf(`INSERT INTO "%s" (dirhash,name,directory,meta) VALUES($1,$2,$3,$4)`, tableName)
if gen.InsertQueryTemplate != "" {
return fmt.Sprintf(gen.InsertQueryTemplate, tableName)
} else {
return fmt.Sprintf(`INSERT INTO "%s" (dirhash,name,directory,meta) VALUES($1,$2,$3,$4)`, tableName)
}
}
func (gen *SqlGenPostgres) GetSqlUpdate(tableName string) string {