package smithy import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/modules" "go_dreamfactory/pb" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/x/bsonx" ) type modelAtlas struct { modules.MCompModel module *Smithy } func (this *modelAtlas) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { this.TableName = string(comm.TableAtlas) err = this.MCompModel.Init(service, module, comp, options) this.module = module.(*Smithy) // uid 创建索引 this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}}, }) return } func (this *modelAtlas) getSmithyAtlasList(uid string) (result *pb.DBAtlas, err error) { result = &pb.DBAtlas{} if err = this.Get(uid, result); err != nil { return } return result, nil } func (this *modelAtlas) modifySmithyAtlasList(uid string, data map[string]interface{}) error { return this.Change(uid, data) }