1
This commit is contained in:
parent
f753f0cf02
commit
b1b47302a3
@ -132,9 +132,9 @@ func (this *IdMetaTable[T]) Load() {
|
||||
if this.PrimKey == "" {
|
||||
this.idHash[i] = obj
|
||||
} else {
|
||||
ele := reflect.ValueOf(obj).Elem()
|
||||
in := []reflect.Value{}
|
||||
out := ele.FieldByName(getFuncName).Call(in)
|
||||
method := reflect.ValueOf(obj).MethodByName(getFuncName)
|
||||
out := method.Call(in)
|
||||
if key, err := q5.ToInt64Ex(out[0].Interface()); err == nil {
|
||||
this.idHash[key] = obj
|
||||
} else {
|
||||
@ -160,9 +160,9 @@ func (this *NameMetaTable[T]) Load() {
|
||||
i := int64(0)
|
||||
getFuncName := "Get" + q5.ConvertUpperCamelCase(this.PrimKey)
|
||||
this.Traverse(func (obj *T) bool {
|
||||
ele := reflect.ValueOf(obj).Elem()
|
||||
in := []reflect.Value{}
|
||||
out := ele.FieldByName(getFuncName).Call(in)
|
||||
method := reflect.ValueOf(obj).MethodByName(getFuncName)
|
||||
out := method.Call(in)
|
||||
if key, err := q5.ToStringEx(out[0].Interface()); err == nil {
|
||||
this.nameHash[key] = obj
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user