aboutsummaryrefslogtreecommitdiff
path: root/weed/filer/postgres2/postgres2_store.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2021-03-29 00:42:48 -0700
committerGitHub <noreply@github.com>2021-03-29 00:42:48 -0700
commit1ebdbad222207c858e9f1285bc7d854f7a943754 (patch)
tree5e9f8b8ac16d2e3cb795f85b49d0352e20cffeb3 /weed/filer/postgres2/postgres2_store.go
parent6b7aa9633fcffe36b29961108d1d811952ab093a (diff)
parent96c62bd34d4d2c99dea3164a9c062abaddb4eaab (diff)
downloadseaweedfs-1ebdbad222207c858e9f1285bc7d854f7a943754.tar.xz
seaweedfs-1ebdbad222207c858e9f1285bc7d854f7a943754.zip
Merge pull request #1946 from LazyDBA247-Anyvision/master
Adding Customisation - insertQuery for postgres/mysql
Diffstat (limited to 'weed/filer/postgres2/postgres2_store.go')
-rw-r--r--weed/filer/postgres2/postgres2_store.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/weed/filer/postgres2/postgres2_store.go b/weed/filer/postgres2/postgres2_store.go
index 92893bf7a..b83945db6 100644
--- a/weed/filer/postgres2/postgres2_store.go
+++ b/weed/filer/postgres2/postgres2_store.go
@@ -32,6 +32,7 @@ func (store *PostgresStore2) GetName() string {
func (store *PostgresStore2) Initialize(configuration util.Configuration, prefix string) (err error) {
return store.initialize(
configuration.GetString(prefix+"createTable"),
+ configuration.GetString(prefix+"insertQuery"),
configuration.GetString(prefix+"username"),
configuration.GetString(prefix+"password"),
configuration.GetString(prefix+"hostname"),
@@ -45,12 +46,13 @@ func (store *PostgresStore2) Initialize(configuration util.Configuration, prefix
)
}
-func (store *PostgresStore2) initialize(createTable, user, password, hostname string, port int, database, schema, sslmode string, maxIdle, maxOpen, maxLifetimeSeconds int) (err error) {
+func (store *PostgresStore2) initialize(createTable, insertQuery, user, password, hostname string, port int, database, schema, sslmode string, maxIdle, maxOpen, maxLifetimeSeconds int) (err error) {
store.SupportBucketTable = true
store.SqlGenerator = &postgres.SqlGenPostgres{
CreateTableSqlTemplate: createTable,
DropTableSqlTemplate: `drop table "%s"`,
+ InsertQueryTemplate: insertQuery,
}
sqlUrl := fmt.Sprintf(CONNECTION_URL_PATTERN, hostname, port, sslmode)