Documentation ¶
Index ¶
- Constants
- Variables
- func Count(where interface{}, args ...interface{}) (int, error)
- func Delete(where ...interface{}) (result sql.Result, err error)
- func FindCount(where ...interface{}) (int, error)
- func FindValue(fieldsAndWhere ...interface{}) (gdb.Value, error)
- func Insert(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 Scan(requestPage *api.RequestPage, pointer interface{}, where interface{}, ...) 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) 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 ¶
View Source
const ( // ColumnID - the id column of entity. ColumnID = "id" // ColumnSeasonID - the season_id column of entity. ColumnSeasonID = "seasonId" // ColumnName - the name column of entity. ColumnName = "name" // ColumnEmail - the email column of entity. ColumnEmail = "email" // ColumnPhone - the phone column of entity. ColumnPhone = "phone" // ColumnPassword - the password column of entity. ColumnPassword = "password" // ColumnRating - the rating column of entity. ColumnRating = "rating" )
Variables ¶
View Source
var ( // Table is the table name of users. Table = "users" // Model is the model object of users. Model = &arModel{g.DB("default").Table(Table).Safe()} )
View Source
var ( // AllQueryColumns - all columns used for query, which doesn't include sensitive columns (e.g. password). AllQueryColumns = gset.NewFrom([]string{ ColumnID, ColumnSeasonID, ColumnName, ColumnEmail, ColumnPhone, ColumnRating}) )
Functions ¶
func Scan ¶
func Scan(requestPage *api.RequestPage, pointer interface{}, where interface{}, args ...interface{}) error
Scan - scan the table to specific result, and apply default filter about current season id.
Types ¶
type Entity ¶
type Entity struct { Id int64 `orm:"id,primary" json:"id"` // SeasonId int64 `orm:"season_id" json:"season_id"` // Name string `orm:"name,unique" json:"name"` // Email string `orm:"email,unique" json:"email"` // Phone string `orm:"phone,unique" json:"phone"` // Password string `orm:"password,unique" json:"password"` // Rating int `orm:"rating" json:"rating"` // }
Entity is the golang structure for table users.
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) 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.
Click to show internal directories.
Click to hide internal directories.