Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBatchUpdateSQL ¶
func GetBatchUpdateSQL(tableName, pkName string, pks []int64, values map[string]map[int64]interface{}) string
GetBatchUpdateSQL 根据给定的主键列表对相应的值进行批量更新 UPDATE <tableName> SET
<fieldname1> = CASE pkName WHEN <pk1> THEN <interface{}> WHEN <pk2> THEN <interface{}> WHEN <pk3> THEN <interface{}> END, <fieldname1> = CASE pkName WHEN <pk1> THEN <interface{}> WHEN <pk1> THEN <interface{}> WHEN <pk1> THEN <interface{}> END
WHERE pkName IN (<pks>)
values: <fieldName1> => { pk1 => interface{} pk2 => interface{} pk3 => interface{} }
func GetUnionSQL ¶
GetUnionSQL 通过Union关键字实现多SQL批量查询
( SELECT user_id, amount FROM fission_reward WHERE user_id=123 AND created_at BETWEEN 1575376982 and (1575376982+24*3600*7) ) UNION ALL ( SELECT user_id, amount FROM fission_reward WHERE user_id=456 AND created_at BETWEEN 1575376982 and (1575376982+24*3600*7) )
Types ¶
type BaseSqlBuilder ¶
func (BaseSqlBuilder) BuildWhereClause ¶
func (b BaseSqlBuilder) BuildWhereClause(builder Builder) string
BuildWhereClause 创建where子句
Click to show internal directories.
Click to hide internal directories.