uid 创建索引
This commit is contained in:
parent
bd548b5ff5
commit
1ef8ec4073
@ -11,6 +11,8 @@ import (
|
|||||||
|
|
||||||
mengine "github.com/dengsgo/math-engine/engine"
|
mengine "github.com/dengsgo/math-engine/engine"
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
|
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ModelHero struct {
|
type ModelHero struct {
|
||||||
@ -22,6 +24,10 @@ func (this *ModelHero) Init(service core.IService, module core.IModule, comp cor
|
|||||||
err = this.MCompModel.Init(service, module, comp, options)
|
err = this.MCompModel.Init(service, module, comp, options)
|
||||||
this.moduleHero = module.(*Hero)
|
this.moduleHero = module.(*Hero)
|
||||||
this.TableName = "hero"
|
this.TableName = "hero"
|
||||||
|
// 通过uid创建索引
|
||||||
|
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||||
|
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user