Add: 1. select like function, 2. tglog
This commit is contained in:
parent
4c371afe63
commit
0317dc9f5e
25
dbpool.go
25
dbpool.go
@ -84,6 +84,24 @@ func (this *dbPool) OrmSelect(
|
||||
this.internalQuery(dataSource, sql, params, cb)
|
||||
}
|
||||
|
||||
func (this *dbPool) SelectLike(
|
||||
dataSource string,
|
||||
tblName string,
|
||||
fields []string,
|
||||
whereKv [][]string,
|
||||
likeWhere [][]string,
|
||||
limit int,
|
||||
cb QueryResultCb) {
|
||||
var params []string
|
||||
|
||||
sql := fmt.Sprintf("SELECT %s FROM %s WHERE 1=1 ", this.joinSelectFields(fields), tblName)
|
||||
this.joinWhere(&sql, ¶ms, whereKv)
|
||||
this.joinWhereLike(&sql, ¶ms, likeWhere)
|
||||
sql = fmt.Sprintf("%s LIMIT %d", sql, limit)
|
||||
|
||||
this.internalQuery(dataSource, sql, params, cb)
|
||||
}
|
||||
|
||||
func (this *dbPool) SelectOne(
|
||||
dataSource string,
|
||||
tblName string,
|
||||
@ -259,6 +277,13 @@ func (this *dbPool) joinWhere(sql *string, params *[]string, whereKv [][]string)
|
||||
}
|
||||
}
|
||||
|
||||
func (this *dbPool) joinWhereLike(sql *string, params *[]string, whereKv [][]string) {
|
||||
for _, items := range whereKv {
|
||||
*sql += " AND " + items[0] + " LIKE ? "
|
||||
*params = append(*params, items[1])
|
||||
}
|
||||
}
|
||||
|
||||
func (this *dbPool) joinUpdateFields(fieldsKv [][]string, params *[]string) string {
|
||||
sql := ""
|
||||
for index, items := range fieldsKv {
|
||||
|
17
tglog.go
17
tglog.go
@ -1,10 +1,10 @@
|
||||
package f5
|
||||
|
||||
import (
|
||||
"q5"
|
||||
"os"
|
||||
"sync"
|
||||
"fmt"
|
||||
"os"
|
||||
"q5"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -36,17 +36,6 @@ func (this *tgLog) SetPolyLog(isPolyLog bool) {
|
||||
}
|
||||
|
||||
func (this *tgLog) AddTrackLog(
|
||||
gameId int32,
|
||||
accountId string,
|
||||
remoteAddr string,
|
||||
logClass1 int32,
|
||||
logClass2 int32,
|
||||
prop map[string]string) {
|
||||
eventName := fmt.Sprintf("event_%d_%d", logClass1, logClass2)
|
||||
this.AddTrackLogEx(gameId, accountId, remoteAddr, eventName, prop)
|
||||
}
|
||||
|
||||
func (this *tgLog) AddTrackLogEx(
|
||||
gameId int32,
|
||||
accountId string,
|
||||
remoteAddr string,
|
||||
|
Loading…
x
Reference in New Issue
Block a user