model

package
v0.0.0-...-2017d89 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2018 License: Unlicense Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DismissUserFromAdmin

func DismissUserFromAdmin(db *gorm.DB, user *User) (err error)

func MakeAdmin

func MakeAdmin(user *User) (err error)

func MakeUser

func MakeUser(user *User) (err error)

func PromoteUserToAdmin

func PromoteUserToAdmin(db *gorm.DB, user *User) (err error)

func StoreUser

func StoreUser(db *gorm.DB, user *User) (err error)

func UpdateUser

func UpdateUser(db *gorm.DB, user *User, patch map[string]string) (err error)

func UpdateUserSetPassword

func UpdateUserSetPassword(db *gorm.DB, user *User, password string) (err error)

func UpdateUserSetUsername

func UpdateUserSetUsername(db *gorm.DB, user *User, username string) (err error)

Types

type User

type User struct {
	ID        uint       `gorm:"AUTO_INCREMENT" json:"id"`
	UUID      string     `gorm:"not null;unique" json:"uuid"`
	Name      string     `json:"name"`
	Username  string     `gorm:"not null;unique" json:"username"`
	Password  string     `json:"password"`
	IsAdmin   bool       `json:"is_admin"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	DeletedAt *time.Time `json:"deleted_at"`
}

func GetUserByUUID

func GetUserByUUID(db *gorm.DB, UUID string) (user User, err error)

func GetUserByUsername

func GetUserByUsername(db *gorm.DB, username string) (user User, err error)

func ListUsers

func ListUsers(db *gorm.DB, page uint, perPage uint, orderBy string, order string) (users []User, total uint, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL