code format

This commit is contained in:
殷勇 2023-09-04 18:29:00 +08:00
parent 155220a3b2
commit fe1acddcc8
3 changed files with 25 additions and 26 deletions

View File

@ -363,7 +363,7 @@ func (this *dbPool) internalQueryOne(dataSource string, sql string, params []str
if err == nil { if err == nil {
dataSet = NewDataSet(rows) dataSet = NewDataSet(rows)
} }
GetSysLog().Info("xxxxxxxxxxxxxxxxxxx")
if this.style == GO_STYLE_DB { if this.style == GO_STYLE_DB {
cb(err, dataSet) cb(err, dataSet)
} else { } else {

View File

@ -1,12 +1,12 @@
package f5 package f5
import ( import (
"reflect"
"q5"
"os"
"bufio" "bufio"
"fmt"
"encoding/json" "encoding/json"
"fmt"
"os"
"q5"
"reflect"
) )
type MetaTable interface { type MetaTable interface {
@ -23,9 +23,9 @@ type LoadFromKeyValue interface {
type RawMetaTable[T any] struct { type RawMetaTable[T any] struct {
FileName string FileName string
PrimKey string PrimKey string
NoLoad bool NoLoad bool
rawList []*T rawList []*T
} }
type IdMetaTable[T any] struct { type IdMetaTable[T any] struct {
@ -38,7 +38,7 @@ type NameMetaTable[T any] struct {
nameHash map[string]*T nameHash map[string]*T
} }
func (this *RawMetaTable[T]) Traverse(cb func (*T) bool) { func (this *RawMetaTable[T]) Traverse(cb func(*T) bool) {
for _, val := range this.rawList { for _, val := range this.rawList {
if !cb(val) { if !cb(val) {
break break
@ -66,7 +66,7 @@ func (this *RawMetaTable[T]) ElementsInit(round int) {
type RoundInit3 interface { type RoundInit3 interface {
Init3() Init3()
} }
this.Traverse(func (obj *T) bool { this.Traverse(func(obj *T) bool {
var x interface{} = obj var x interface{} = obj
switch round { switch round {
case 0: case 0:
@ -128,7 +128,7 @@ func (this *IdMetaTable[T]) Load() {
this.idHash = make(map[int64]*T) this.idHash = make(map[int64]*T)
i := int64(0) i := int64(0)
getFuncName := "Get" + q5.ConvertUpperCamelCase(this.PrimKey) getFuncName := "Get" + q5.ConvertUpperCamelCase(this.PrimKey)
this.Traverse(func (obj *T) bool { this.Traverse(func(obj *T) bool {
if this.PrimKey == "" { if this.PrimKey == "" {
this.idHash[i] = obj this.idHash[i] = obj
} else { } else {
@ -159,7 +159,7 @@ func (this *NameMetaTable[T]) Load() {
this.nameHash = make(map[string]*T) this.nameHash = make(map[string]*T)
i := int64(0) i := int64(0)
getFuncName := "Get" + q5.ConvertUpperCamelCase(this.PrimKey) getFuncName := "Get" + q5.ConvertUpperCamelCase(this.PrimKey)
this.Traverse(func (obj *T) bool { this.Traverse(func(obj *T) bool {
in := []reflect.Value{} in := []reflect.Value{}
method := reflect.ValueOf(obj).MethodByName(getFuncName) method := reflect.ValueOf(obj).MethodByName(getFuncName)
out := method.Call(in) out := method.Call(in)

View File

@ -7,36 +7,35 @@ import (
const ( const (
WSPROXYPACKHEAD_C_SIZE = 20 WSPROXYPACKHEAD_C_SIZE = 20
WSPROXYPACKHEAD_S_SIZE = 16 WSPROXYPACKHEAD_S_SIZE = 16
NET_MSG_MAGIC_CODE = uint16('K') + uint16('S') << 8 NET_MSG_MAGIC_CODE = uint16('K') + uint16('S')<<8
) )
type MsgNode struct { type MsgNode struct {
} }
type IMMsgNode struct { type IMMsgNode struct {
msgId uint16 msgId uint16
params q5.Args params q5.Args
next *IMMsgNode next *IMMsgNode
} }
type Pagination struct { type Pagination struct {
Total int32 Total int32
PerPage int32 PerPage int32
CurrentPage int32 CurrentPage int32
TotalPages int32 TotalPages int32
Rows *DataSet Rows *DataSet
} }
type HandlerFunc func(*Context) type HandlerFunc func(*Context)
type QueryResultCb func (error, *DataSet) type QueryResultCb func(error, *DataSet)
type QueryOneCb func (error, *[]*string) type QueryOneCb func(error, *DataSet)
type PageQueryCb func (error, *Pagination) type PageQueryCb func(error, *Pagination)
type ExecResultCb func (error, int64, int64) type ExecResultCb func(error, int64, int64)
type middleware struct { type middleware struct {
middlewareType int32 middlewareType int32
handlerFunc HandlerFunc handlerFunc HandlerFunc
entry q5.ListHead entry q5.ListHead
} }