package
Version:
v0.0.0-...-3268d42
Opens a new window with list of versions in this module.
Published: May 29, 2020
License: MIT
Opens a new window with license information.
Imports: 10
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
DeleteUser deletes the user by the user identifier.
type BaseModel struct {
Id uint64 `gorm:"primary_key;AUTO_INCREMENT;column:id" json:"-"`
CreatedAt time.Time `gorm:"column:createdAt" json:"-"`
UpdatedAt time.Time `gorm:"column:updatedAt" json:"-"`
DeletedAt *time.Time `gorm:"column:deletedAt" sql:"index" json:"-"`
}
type Token struct {
Token string `json:"token"`
}
Token represents a JSON web token.
type UserInfo struct {
Id uint64 `json:"id"`
Username string `json:"username"`
SayHello string `json:"sayHello"`
Password string `json:"password"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
type UserModel struct {
BaseModel
Username string `json:"username" gorm:"column:username;not null" binding:"required" validate:"min=1,max=32"`
Password string `json:"password" gorm:"column:password;not null" binding:"required" validate:"min=5,max=128"`
}
User represents a registered user.
GetUser gets an user by the user identifier.
Compare with the plain text password. Returns true if it's the same as the encrypted one (in the `User` struct).
Create creates a new user account.
Encrypt the user password.
Update updates an user account information.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.