package tools_regis import ( "ai_scheduler/internal/data/constants" "ai_scheduler/internal/data/impl" "ai_scheduler/internal/data/model" "xorm.io/builder" ) type ToolRegis struct { //待优化 BootTools []model.AiBotTool } func NewToolsRegis(botToolsImpl *impl.BotToolsImpl) *ToolRegis { botTools := &ToolRegis{} err := botTools.RegisTools(botToolsImpl) if err != nil { panic(err) } return botTools } func (t *ToolRegis) RegisTools(botToolsImpl *impl.BotToolsImpl) error { cond := builder.NewCond() cond = cond.And(builder.Eq{"status": constants.Enable}) err := botToolsImpl.GetRangeToMapStruct(&cond, &t.BootTools) return err }