users

package
v0.90.38 Latest Latest
Warning

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

Go to latest
Published: May 10, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Samples

func Samples() error

func SetDB

func SetDB(database database.Database)

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"`
	ApiSecret string        `gorm:"column:api_secret" json:"api_secret,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 All

func All() []*User

func AuthUser

func AuthUser(username, password string) (*User, bool)

AuthUser will return the User and a boolean if authentication was correct. AuthUser accepts username, and password as a string

func Find

func Find(id int64) (*User, error)

func FindByUsername

func FindByUsername(username string) (*User, error)

func (*User) BeforeCreate

func (u *User) BeforeCreate() error

func (*User) Create

func (u *User) Create() error

func (*User) Delete

func (u *User) Delete() error

func (*User) Update

func (u *User) Update() error

Jump to

Keyboard shortcuts

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