package forum import ( "go_dreamfactory/lego/core" "go_dreamfactory/modules" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/x/bsonx" ) ///论坛 数据组件 type modelForumComp struct { modules.MCompModel module *Forum } //组件初始化接口 func (this *modelForumComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) { this.MCompModel.Init(service, module, comp, opt) this.module = module.(*Forum) this.TableName = "forum" //创建uid索引 this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}}, }) return }