Documentation ¶
Overview ¶
Code generated by gotoc_mongo. DO NOT EDIT. gotoc version: 0.0.3 source: samples/mongo/user.mongo.gtc
Index ¶
- Constants
- func EnsureLogKeys()
- func EnsureUserKeys()
- func GetTestCol(colName string) (*mgo.Session, *mgo.Collection)
- func InitTest(getter mgoimpl.SessionGetter)
- func RemoveLogById(id string) error
- func RemoveUserById(id string) error
- type Log
- type QueryLogContext
- func (c *QueryLogContext) Batch(b int) *QueryLogContext
- func (c *QueryLogContext) Count() (int, error)
- func (c *QueryLogContext) Find() (os []*Log, err error)
- func (c *QueryLogContext) FindOne() (o *Log, err error)
- func (c *QueryLogContext) Limit(offset, limit int) *QueryLogContext
- func (c *QueryLogContext) Select(selectFields ...string) *QueryLogContext
- func (c *QueryLogContext) Sort(sortFields ...string) *QueryLogContext
- func (c *QueryLogContext) Timeout(t time.Duration) *QueryLogContext
- func (c *QueryLogContext) Walk(walkFunc func(*Log) error) error
- type QueryUserContext
- func (c *QueryUserContext) Batch(b int) *QueryUserContext
- func (c *QueryUserContext) Count() (int, error)
- func (c *QueryUserContext) Find() (os []*User, err error)
- func (c *QueryUserContext) FindOne() (o *User, err error)
- func (c *QueryUserContext) Limit(offset, limit int) *QueryUserContext
- func (c *QueryUserContext) Select(selectFields ...string) *QueryUserContext
- func (c *QueryUserContext) Sort(sortFields ...string) *QueryUserContext
- func (c *QueryUserContext) Timeout(t time.Duration) *QueryUserContext
- func (c *QueryUserContext) Walk(walkFunc func(*User) error) error
- type User
Constants ¶
const ( UserName = "name" UserPassword = "password" UserEmail = "email" UserCredits = "credits" UserManId = "manId" UserCreateDate = "createDate" )
mongodb fields name for user
const ( UserNameDesc = "-name" UserPasswordDesc = "-password" UserEmailDesc = "-email" UserCreditsDesc = "-credits" UserManIdDesc = "-manId" UserCreateDateDesc = "-createDate" )
mongodb fields DESC name(for sort) for user
const ( LogUserId = "userId" LogType = "type" LogEvent = "event" )
mongodb fields name for user_log
const ( LogUserIdDesc = "-userId" LogTypeDesc = "-type" LogEventDesc = "-event" )
mongodb fields DESC name(for sort) for user_log
const ColLogName = "user_log"
const ColUserName = "user"
const TestName = "test"
Variables ¶
This section is empty.
Functions ¶
func GetTestCol ¶
func GetTestCol(colName string) (*mgo.Session, *mgo.Collection)
func InitTest ¶
func InitTest(getter mgoimpl.SessionGetter)
func RemoveLogById ¶
RemoveLogById remove objects in mongodb by id
func RemoveUserById ¶
RemoveUserById remove objects in mongodb by id
Types ¶
type Log ¶
type Log struct { // ID for user_log ID bson.ObjectId `json:"id" bson:"_id,omitempty"` // 用户id UserId string `json:"userId" bson:"userId"` // 类型 Type int32 `json:"type" bson:"type"` // 发生的事件 Event []string `json:"event" bson:"event"` }
Log 用户日志表
func FindLogById ¶
FindLogById get object from mongodb by id
type QueryLogContext ¶
type QueryLogContext struct {
// contains filtered or unexported fields
}
QueryLogContext is used to implement query operation
func QueryLog ¶
func QueryLog(filter interface{}) *QueryLogContext
QueryLog create a new query context instance
func (*QueryLogContext) Batch ¶
func (c *QueryLogContext) Batch(b int) *QueryLogContext
Batch set batch size
func (*QueryLogContext) FindOne ¶
func (c *QueryLogContext) FindOne() (o *Log, err error)
FindOne result
func (*QueryLogContext) Limit ¶
func (c *QueryLogContext) Limit(offset, limit int) *QueryLogContext
Limit set offset and limit
func (*QueryLogContext) Select ¶
func (c *QueryLogContext) Select(selectFields ...string) *QueryLogContext
Select set select fields
func (*QueryLogContext) Sort ¶
func (c *QueryLogContext) Sort(sortFields ...string) *QueryLogContext
Sort set sort fields
func (*QueryLogContext) Timeout ¶
func (c *QueryLogContext) Timeout(t time.Duration) *QueryLogContext
Timeout set query timeout
type QueryUserContext ¶
type QueryUserContext struct {
// contains filtered or unexported fields
}
QueryUserContext is used to implement query operation
func QueryUser ¶
func QueryUser(filter interface{}) *QueryUserContext
QueryUser create a new query context instance
func (*QueryUserContext) Batch ¶
func (c *QueryUserContext) Batch(b int) *QueryUserContext
Batch set batch size
func (*QueryUserContext) Find ¶
func (c *QueryUserContext) Find() (os []*User, err error)
Find results
func (*QueryUserContext) FindOne ¶
func (c *QueryUserContext) FindOne() (o *User, err error)
FindOne result
func (*QueryUserContext) Limit ¶
func (c *QueryUserContext) Limit(offset, limit int) *QueryUserContext
Limit set offset and limit
func (*QueryUserContext) Select ¶
func (c *QueryUserContext) Select(selectFields ...string) *QueryUserContext
Select set select fields
func (*QueryUserContext) Sort ¶
func (c *QueryUserContext) Sort(sortFields ...string) *QueryUserContext
Sort set sort fields
func (*QueryUserContext) Timeout ¶
func (c *QueryUserContext) Timeout(t time.Duration) *QueryUserContext
Timeout set query timeout
type User ¶
type User struct { // ID for user ID bson.ObjectId `json:"id" bson:"_id,omitempty"` // 用户名 Name string `json:"name" bson:"name"` // 用户密码 Password string `json:"password" bson:"password"` // 用户邮箱 Email string `json:"email" bson:"email"` // 用户信用记录 Credits []string `json:"credits" bson:"credits"` // ManId int64 `json:"manId" bson:"manId"` // CreateDate int64 `json:"createDate" bson:"createDate"` }
User 用户表
func FindUserById ¶
FindUserById get object from mongodb by id