package master import ( "analysis/app" "analysis/logo" "plugin" "basic.com/libgowrapper/sdkstruct.git" ) // Fetcher db type Fetcher struct { fnInitDBAPI func(string, int, int, int, func(...interface{})) fnSDKInfo func() []sdkstruct.SDKInfo } // NewFetcher new func NewFetcher(soFile string) *Fetcher { plug, err := plugin.Open(soFile) if err != nil { logo.Errorln("Open: ", soFile, " error: ", err) return nil } fn, err := app.LoadFunc(plug, soFile, "InitDBAPI") if err != nil { logo.Infoln("Lookup Func InitDBAPI From File: ", soFile, " Error") return nil } fnInit := fn.(func(string, int, int, int, func(...interface{}))) fn, err = app.LoadFunc(plug, soFile, "SDKInfo") if err != nil { logo.Infoln("Lookup Func SDKInfo From File: ", soFile, " Error") return nil } fnSDKInfo := fn.(func() []sdkstruct.SDKInfo) return &Fetcher{ fnInitDBAPI: fnInit, fnSDKInfo: fnSDKInfo, } }