This commit is contained in:
aozhiwei 2023-08-12 16:27:02 +08:00
parent f753f0cf02
commit b1b47302a3

View File

@ -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 {