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