Documentation
¶
Index ¶
- func Samples() error
- func SetDB(database database.Database)
- type Scope
- type User
- func (u *User) AfterCreate()
- func (u *User) AfterDelete()
- func (u *User) AfterFind()
- func (u *User) AfterUpdate()
- func (u *User) AllScopes() []Scope
- func (u *User) BeforeCreate() error
- func (u *User) BeforeDelete() error
- func (u *User) BeforeUpdate() error
- func (u *User) Create() error
- func (u *User) Delete() error
- func (u *User) Update() error
- func (u *User) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type User ¶
type User struct {
Id int64 `gorm:"primary_key;column:id" json:"id"`
Username string `gorm:"type:varchar(100);unique;column:username;" json:"username,omitempty"`
Password string `gorm:"column:password" json:"password,omitempty"`
Email string `gorm:"type:varchar(100);column:email" json:"email,omitempty"`
ApiKey string `gorm:"column:api_key" json:"api_key,omitempty"`
Scopes string `gorm:"column:scopes" json:"scopes,omitempty"`
Admin null.NullBool `gorm:"column:administrator" json:"admin,omitempty"`
CreatedAt time.Time `gorm:"column:created_at" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"`
Token string `gorm:"-" json:"token"`
}
User is the main struct for Users
func AuthUser ¶
AuthUser will return the User and a boolean if authentication was correct. accepts username, and password as a string
func FindByAPIKey ¶
func FindByUsername ¶
func (*User) AfterCreate ¶
func (u *User) AfterCreate()
func (*User) AfterDelete ¶
func (u *User) AfterDelete()
func (*User) AfterUpdate ¶
func (u *User) AfterUpdate()
func (*User) BeforeCreate ¶
func (*User) BeforeDelete ¶
func (*User) BeforeUpdate ¶
Click to show internal directories.
Click to hide internal directories.