From 2674163215197b959ea74d14481ea5e89c16112d Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 10 Sep 2020 11:15:29 +0800 Subject: [PATCH] 1 --- metamgr.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/metamgr.go b/metamgr.go index aeca4f5..6ca8e4d 100644 --- a/metamgr.go +++ b/metamgr.go @@ -63,6 +63,8 @@ func (this *MetaMgr) Load() { this.wrapNameHash = make([]map[string]interface{}, len(*this.metaClasses)) this.loadRawMetaTable() this.bindPrimKey() + this.firstInitMetaList() + this.secondInitMetaList() } func (this *MetaMgr) loadRawMetaTable() { @@ -286,3 +288,29 @@ func (this *MetaMgr) adjustJsonForamt(metaClass *MetaClass, rawData string) stri } return string(newData) } + +func (this *MetaMgr) firstInitMetaList() { + for i := 0; i < len(this.wrapList); i++ { + metaList := reflect.ValueOf(this.wrapList[i]) + for ii := 0; ii < metaList.Len(); ii++ { + meta := metaList.Index(ii) + initFunc := meta.MethodByName("Init") + if initFunc.IsValid() { + initFunc.Call(nil) + } + } + } +} + +func (this *MetaMgr) secondInitMetaList() { + for i := 0; i < len(this.wrapList); i++ { + metaList := reflect.ValueOf(this.wrapList[i]) + for i := 0; i < metaList.Len(); i++ { + meta := metaList.Index(i) + init2Func := meta.MethodByName("Init2") + if init2Func.IsValid() { + init2Func.Call(nil) + } + } + } +}