Documentation
¶
Index ¶
- Variables
- func Delete(where ...interface{}) (result sql.Result, err error)
- func FindArray(fieldsAndWhere ...interface{}) ([]gdb.Value, error)
- func FindCount(where ...interface{}) (int, error)
- func FindValue(fieldsAndWhere ...interface{}) (gdb.Value, error)
- func Insert(data ...interface{}) (result sql.Result, err error)
- func InsertIgnore(data ...interface{}) (result sql.Result, err error)
- func Replace(data ...interface{}) (result sql.Result, err error)
- func Save(data ...interface{}) (result sql.Result, err error)
- func Update(dataAndWhere ...interface{}) (result sql.Result, err error)
- type Entity
- func (r *Entity) Delete() (result sql.Result, err error)
- func (r *Entity) Insert() (result sql.Result, err error)
- func (r *Entity) InsertIgnore() (result sql.Result, err error)
- func (r *Entity) OmitEmpty() *arModel
- func (r *Entity) Replace() (result sql.Result, err error)
- func (r *Entity) Save() (result sql.Result, err error)
- func (r *Entity) Update() (result sql.Result, err error)
Constants ¶
This section is empty.
Variables ¶
var ( // Table is the table name of gf_user. Table = "gf_user" // Model is the model object of gf_user. Model = &arModel{g.DB("default").Table(Table).Safe()} // Columns defines and stores column names for table gf_user. Columns = struct { Id string // UID Rid string // 角色ID,允许负数: < 0 系统使用 > 0 业务使用 一个用户只有一个角色 Passport string // 账号 Password string // MD5密码 Nickname string // 昵称 Avatar string // 头像地址 Status string // 状态 1:启用 0:禁用 Gender string // 性别 0: 未设置 1: 男 2: 女 CreateAt string // 注册时间 UpdateAt string // 更新时间 }{ Id: "id", Rid: "rid", Passport: "passport", Password: "password", Nickname: "nickname", Avatar: "avatar", Status: "status", Gender: "gender", CreateAt: "create_at", UpdateAt: "update_at", } )
Functions ¶
func InsertIgnore ¶
InsertIgnore is a convenience method for Model.InsertIgnore.
Types ¶
type Entity ¶
type Entity struct { Id uint `orm:"id,primary" json:"id"` // UID Rid uint `orm:"rid" json:"rid"` // 角色ID,允许负数: < 0 系统使用 > 0 业务使用 一个用户只有一个角色 Passport string `orm:"passport" json:"passport"` // 账号 Password string `orm:"password" json:"password"` // MD5密码 Nickname string `orm:"nickname" json:"nickname"` // 昵称 Avatar string `orm:"avatar" json:"avatar"` // 头像地址 Status int `orm:"status" json:"status"` // 状态 1:启用 0:禁用 Gender int `orm:"gender" json:"gender"` // 性别 0: 未设置 1: 男 2: 女 Token string `orm:"token" ` // github token CreateAt *gtime.Time `orm:"create_at" json:"create_at"` // 注册时间 UpdateAt *gtime.Time `orm:"update_at" json:"update_at"` // 更新时间 }
Entity is the golang structure for table gf_user.
func (*Entity) Delete ¶
Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
func (*Entity) Insert ¶
Inserts does "INSERT...INTO..." statement for inserting current object into table.
func (*Entity) InsertIgnore ¶
InsertIgnore does "INSERT IGNORE INTO ..." statement for inserting current object into table.
func (*Entity) OmitEmpty ¶
func (r *Entity) OmitEmpty() *arModel
OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers the data and where attributes for empty values.
func (*Entity) Replace ¶
Replace does "REPLACE...INTO..." statement for inserting current object into table. If there's already another same record in the table (it checks using primary key or unique index), it deletes it and insert this one.