Documentation ¶
Index ¶
- type DbBase
- type User
- func (a *User) CName() string
- func (a *User) DeleteByID() error
- func (a *User) GetCountByUsernameOrEmail() (int, error)
- func (a *User) GetOneByEmail() (User, error)
- func (a *User) GetOneByID() (User, error)
- func (a *User) GetOneByUsername() (User, error)
- func (a *User) GetTotalCount() (int, error)
- func (a *User) Insert() error
- func (a *User) UpdateByID() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DbBase ¶
type DbBase struct{}
DbBase 提供操作数据库的基类
func (*DbBase) Collection ¶
func (d *DbBase) Collection(cName string) *mgo.Collection
Collection 获取操作集合
type User ¶
type User struct { DbBase `bson:",omitempty"` ID bson.ObjectId `bson:"_id,omitempty" json:"id"` Username string `bson:"username,omitempty" json:"username"` // Username 用户名 Password string `bson:"password,omitempty" json:"password"` // Password 摘要后的密码 Email string `bson:"email,omitempty" json:"email"` // Email 邮箱 IsAdmin bool `bson:"isAdmin,omitempty" json:"isAdmin"` // IsAdmin 是否为管理员 IsAbleLogin bool `bson:"isAbleLogin,omitempty" json:"isAbleLogin"` // IsAbleLogin 是否可以登录 CreateTime time.Time `bson:"createTime,omitempty" json:"createTime"` // CreateTime 创建时间 }
User 用户 模型
func (*User) GetCountByUsernameOrEmail ¶
GetCountByUsernameOrEmail 根据 用户名 或 邮箱 获取记录条数
func (*User) GetOneByUsername ¶
GetOneByUsername 根据id 获取单条数据
Click to show internal directories.
Click to hide internal directories.