数据库操作
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

21 lines
473 B

package dbquery
import (
"git.tetele.net/tgo/helper"
"strings"
)
// 对执行前的sql语句进行处理--针对pgsql用
func SqlReplace(sql_s, sql_type string) string {
sql := strings.Replace(sql_s, "`", `"`, -1)
if sql_type == "add" {
sql = helper.StringJoin(sql, " RETURNING id")
}
sql = strings.Replace(sql, " user ", ` "user" `, -1)
sql = strings.Replace(sql, " user.", ` "user".`, -1)
sql = strings.Replace(sql, "=user.", `="user".`, -1)
return sql
}