mirror of
https://gitee.com/johng/gf
synced 2026-07-08 14:39:50 +08:00
This commit is contained in:
@ -30,7 +30,7 @@ type ConfigNode struct {
|
||||
User string `json:"user"` // Authentication username.
|
||||
Pass string `json:"pass"` // Authentication password.
|
||||
Name string `json:"name"` // Default used database name.
|
||||
Type string `json:"type"` // Database type: mysql, sqlite, mssql, pgsql, oracle.
|
||||
Type string `json:"type"` // Database type: mysql, mariadb, sqlite, mssql, pgsql, oracle, clickhouse, dm.
|
||||
Link string `json:"link"` // (Optional) Custom link information for all configuration in one single string.
|
||||
Extra string `json:"extra"` // (Optional) Extra configuration according the registered third-party database driver.
|
||||
Role string `json:"role"` // (Optional, "master" in default) Node role, used for master-slave mode: master, slave.
|
||||
|
||||
@ -929,3 +929,18 @@ func FormatSqlWithArgs(sql string, args []interface{}) string {
|
||||
})
|
||||
return newQuery
|
||||
}
|
||||
|
||||
// FormatMultiLineSqlToSingle formats sql template string into one line.
|
||||
func FormatMultiLineSqlToSingle(sqlTmp string) string {
|
||||
var err error
|
||||
// format sql template string.
|
||||
sqlTmp, err = gregex.ReplaceString(`[\n\r\s]+`, " ", gstr.Trim(sqlTmp))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
sqlTmp, err = gregex.ReplaceString(`\s{2,}`, " ", gstr.Trim(sqlTmp))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return sqlTmp
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user