Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SendError ¶
func SendError(w http.ResponseWriter)
Types ¶
type Base ¶
type Base struct { ID uint64 `gorm:"primary_key;AUTO_INCREMENT;column:id" json:"id" valid:"-"` CreatedAt time.Time `gorm:"column:createdAt" json:"createdAt" valid:"-"` UpdatedAt time.Time `gorm:"column:updatedAt" json:"updatedAt" valid:"-"` DeletedAt *time.Time `gorm:"column:deletedAt" sql:"index" json:"deletedAt" valid:"-"` }
type Error ¶
type Error struct { // The general error message Error string `json:"error"` // The http error code. ErrorCode int `json:"error_code"` // The http error code. ErrorDescription string `json:"error_description"` }
The Error contains error relevant information.
type QueryParam ¶
type QueryParam struct { Fields string Offset int Limit int Order string Where []WhereParam }
type Result ¶
type Result struct { Code int `json:"code"` // return code, 0 for succ Message string `json:"message"` // message Data interface{} `json:"data"` // data object }
Result represents HTTP response body.
type User ¶
type User struct { Base Username string `gorm:"type:varchar(100);column:username;not null" json:"username" valid:"-"` Password string `gorm:"type:varchar(50);column:password;not null" json:"password" valid:"-"` Email string `gorm:"type:varchar(100);column:email;unique;not null;" json:"email" valid:"email"` }
创建一个User数据模型
type UserResult ¶
type UserResult struct { ID uint64 `json:"id"` Username string `json:"username"` Email string `json:"email"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
创建一个脱敏的User数据模型
type WhereParam ¶
Click to show internal directories.
Click to hide internal directories.