Documentation ¶
Overview ¶
Package v1 defines schemes used by leona-apiserver.
Index ¶
- type User
- func (u *User) AfterCreate(tx *gorm.DB) (err error)
- func (u *User) AfterFind(tx *gorm.DB) (err error)
- func (u *User) BeforeCreate(tx *gorm.DB) (err error)
- func (u *User) BeforeUpdate(tx *gorm.DB) (err error)
- func (u *User) Compare(pwd string) (err error)
- func (u *User) TableName() string
- func (u *User) Validate() field.ErrorList
- func (u *User) ValidateUpdate() field.ErrorList
- type UserList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type User ¶
type User struct { // Standard object's metadata. metav1.ObjectMeta `json:"metadata,omitempty"` Status int `json:"status" gorm:"column:status" validate:"omitempty"` // Required: true Nickname string `json:"nickname" gorm:"column:nickname" validate:"required,min=1,max=30"` // Required: true Password string `json:"password,omitempty" gorm:"column:password" validate:"required"` // Required: true Email string `json:"email" gorm:"column:email" validate:"required,email,min=1,max=100"` Phone string `json:"phone" gorm:"column:phone" validate:"omitempty"` IsAdmin int `json:"isAdmin,omitempty" gorm:"column:isAdmin" validate:"omitempty"` TotalPolicy int64 `json:"totalPolicy" gorm:"-" validate:"omitempty"` LoginedAt time.Time `json:"loginedAt,omitempty" gorm:"column:loginedAt"` }
User represents a user restful resource. It is also used as gorm model.
func (*User) AfterCreate ¶
AfterCreate run after create database record.
func (*User) AfterFind ¶
AfterFind run after find to unmarshal a extend shadown string into metav1.Extend struct.
func (*User) BeforeCreate ¶
BeforeCreate run before create database record.
func (*User) BeforeUpdate ¶
BeforeUpdate run before update database record.
func (*User) Compare ¶
Compare with the plain text password. Returns true if it's the same as the encrypted one (in the `User` struct).
func (*User) ValidateUpdate ¶
ValidateUpdate validates that a user object is valid when update. Like User.Validate but not validate password.
Click to show internal directories.
Click to hide internal directories.