Documentation ¶
Index ¶
- Constants
- Variables
- func Col(col string) *mongo.Collection
- func Get_UserBlogMgr() *_UserBlogMgr
- func Get_UserMgr() *_UserMgr
- func MgoSetup(config *db.MongoConfig, opts ...SetupOptionFn)
- func UserAddInsertCallback(cb func(obj orm.EzOrmObj))
- func UserAddUpdateCallback(cb func(obj orm.EzOrmObj))
- func UserBlogAddInsertCallback(cb func(obj orm.EzOrmObj))
- func UserBlogAddUpdateCallback(cb func(obj orm.EzOrmObj))
- func UserBlogInsertCallback(o *UserBlog)
- func UserBlogUpdateCallback(o *UserBlog)
- func UserInsertCallback(o *User)
- func UserUpdateCallback(o *User)
- type SetupOption
- type SetupOptionFn
- type User
- func (o *User) FindOneAndSave(ctx context.Context, query interface{}) (*mongo.SingleResult, error)
- func (p *User) GetClassName() string
- func (p *User) GetNameSpace() string
- func (o *User) Id() string
- func (o *User) InsertUnique(ctx context.Context, query interface{}) (saved bool, err error)
- func (o *User) Save(ctx context.Context) (*mongo.UpdateResult, error)
- type UserBlog
- func (o *UserBlog) FindOneAndSave(ctx context.Context, query interface{}) (*mongo.SingleResult, error)
- func (p *UserBlog) GetClassName() string
- func (p *UserBlog) GetNameSpace() string
- func (o *UserBlog) Id() string
- func (o *UserBlog) InsertUnique(ctx context.Context, query interface{}) (saved bool, err error)
- func (o *UserBlog) Save(ctx context.Context) (*mongo.UpdateResult, error)
- type UserBlogMgoSortField_WRP
- type UserMgoSortField_WRP
Constants ¶
View Source
const ( UserBlogMgoFieldID = "_id" UserBlogMgoFieldUserId = "uid" UserBlogMgoFieldBlogId = "bid" UserBlogMgoFieldContent = "Content" )
View Source
const ( UserMgoFieldID = "_id" UserMgoFieldUserId = "uid" UserMgoFieldUsername = "Username" UserMgoFieldAge = "Age" UserMgoFieldRegisterDate = "registerDate" )
Variables ¶
View Source
var ( UserBlogMgoSortFieldIDAsc = primitive.E{Key: "_id", Value: 1} UserBlogMgoSortFieldIDDesc = primitive.E{Key: "_id", Value: -1} )
View Source
var ( UserMgoSortFieldIDAsc = primitive.E{Key: "_id", Value: 1} UserMgoSortFieldIDDesc = primitive.E{Key: "_id", Value: -1} UserMgoSortFieldAgeAsc = primitive.E{Key: "Age", Value: 1} UserMgoSortFieldAgeDesc = primitive.E{Key: "Age", Value: -1} UserMgoSortFieldRegisterDateAsc = primitive.E{Key: "registerDate", Value: 1} UserMgoSortFieldRegisterDateDesc = primitive.E{Key: "registerDate", Value: -1} )
View Source
var UserBlogIndexKey_UserId = bson.D{
{Key: "UserId", Value: 1},
}
View Source
var UserBlogIndexes = []mongo.IndexModel{ { Keys: UserBlogIndexKey_UserId, }, }
View Source
var UserBlogIndexesFunc = func() { orm.SetupIndexModel(Col("test_user_blog"), UserBlogIndexes) }
View Source
var UserBlogMgr *_UserBlogMgr
View Source
var UserIndexKey_Age = bson.D{
{Key: "Age", Value: 1},
}
View Source
var UserIndexKey_RegisterDate = bson.D{
{Key: "RegisterDate", Value: 1},
}
View Source
var UserIndexKey_Username = bson.D{
{Key: "Username", Value: 1},
}
View Source
var UserIndexKey_UsernameAge = bson.D{
{Key: "Username", Value: 1},
{Key: "Age", Value: 1},
}
View Source
var UserIndexes = []mongo.IndexModel{ { Keys: UserIndexKey_UsernameAge, }, { Keys: UserIndexKey_Username, }, { Keys: UserIndexKey_Age, }, { Keys: UserIndexKey_RegisterDate, }, }
View Source
var UserIndexesFunc = func() { orm.SetupIndexModel(Col("test_user"), UserIndexes) }
View Source
var UserMgr *_UserMgr
Functions ¶
func Col ¶
func Col(col string) *mongo.Collection
func Get_UserBlogMgr ¶ added in v2.5.5
func Get_UserBlogMgr() *_UserBlogMgr
Get_UserBlogMgr returns the orm manager in case of its name starts with lower letter
func Get_UserMgr ¶
func Get_UserMgr() *_UserMgr
Get_UserMgr returns the orm manager in case of its name starts with lower letter
func MgoSetup ¶
func MgoSetup(config *db.MongoConfig, opts ...SetupOptionFn)
func UserAddInsertCallback ¶
func UserAddUpdateCallback ¶
func UserBlogAddInsertCallback ¶ added in v2.5.5
func UserBlogAddUpdateCallback ¶ added in v2.5.5
func UserBlogInsertCallback ¶ added in v2.5.5
func UserBlogInsertCallback(o *UserBlog)
func UserBlogUpdateCallback ¶ added in v2.5.5
func UserBlogUpdateCallback(o *UserBlog)
func UserInsertCallback ¶
func UserInsertCallback(o *User)
func UserUpdateCallback ¶
func UserUpdateCallback(o *User)
Types ¶
type SetupOption ¶ added in v2.0.1
type SetupOption struct {
// contains filtered or unexported fields
}
type SetupOptionFn ¶ added in v2.0.1
type SetupOptionFn func(opts *SetupOption)
func WithPostHooks ¶ added in v2.4.7
func WithPostHooks(fn ...func()) SetupOptionFn
func WithPrometheusMonitor ¶ added in v2.0.1
func WithPrometheusMonitor(app, gatewayAddress string) SetupOptionFn
func WithStatsDMonitor ¶ added in v2.0.1
func WithStatsDMonitor(app string) SetupOptionFn
type User ¶
type User struct { ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` // the identity of each user UserId uint64 `bson:"uid" json:"uid"` // name of user used to login Username string `bson:"Username" json:"Username"` Age int32 `bson:"Age" json:"Age"` RegisterDate time.Time `bson:"registerDate" json:"registerDate"` // contains filtered or unexported fields }
User all registered user use our systems
func (*User) FindOneAndSave ¶ added in v2.8.3
FindOneAndSave try to find one doc by `query`, and then upsert the result with the current object
func (*User) GetClassName ¶
func (*User) GetNameSpace ¶
func (*User) InsertUnique ¶
type UserBlog ¶ added in v2.5.5
type UserBlog struct { ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` // the identity of each user UserId uint64 `bson:"uid" json:"uid"` // the identity of each blog BlogId uint64 `bson:"bid" json:"bid"` Content string `bson:"Content" json:"Content"` // contains filtered or unexported fields }
func (*UserBlog) FindOneAndSave ¶ added in v2.8.3
func (o *UserBlog) FindOneAndSave(ctx context.Context, query interface{}) (*mongo.SingleResult, error)
FindOneAndSave try to find one doc by `query`, and then upsert the result with the current object
func (*UserBlog) GetClassName ¶ added in v2.5.5
func (*UserBlog) GetNameSpace ¶ added in v2.5.5
func (*UserBlog) InsertUnique ¶ added in v2.5.5
type UserBlogMgoSortField_WRP ¶ added in v2.5.5
UserBlogMgoSortField_WRP is a wrapper of UserBlog sort fields e.g.: UserBlogMgoSortField_WRP{UserBlogMgoSortField_X_Asc, UserBlogMgoSortField_Y_DESC}
type UserMgoSortField_WRP ¶
UserMgoSortField_WRP is a wrapper of User sort fields e.g.: UserMgoSortField_WRP{UserMgoSortField_X_Asc, UserMgoSortField_Y_DESC}
Click to show internal directories.
Click to hide internal directories.