add enableUpsert=true

and rename config to upsertQuery
This commit is contained in:
LazyDBA247-Anyvision committed 2021-03-30 00:32:03 +03:00
1 parent 3cf84b5fae
commit 4c51e6a660
7 files changed
+46 -34

No files matched your search

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