statping: github.com/statping/statping/types/users Index | Files

package users

import "github.com/statping/statping/types/users"

Index

Package Files

auth.go database.go sample.go struct.go

func Samples Uses

func Samples() error

func SetDB Uses

func SetDB(database database.Database)

type User Uses

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 Uses

func All() []*User

func AuthUser Uses

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 Uses

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

func FindByUsername Uses

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

func (*User) BeforeCreate Uses

func (u *User) BeforeCreate() error

func (*User) Create Uses

func (u *User) Create() error

func (*User) Delete Uses

func (u *User) Delete() error

func (*User) Update Uses

func (u *User) Update() error

Package users imports 6 packages (graph) and is imported by 9 packages. Updated 2020-06-01. Refresh now. Tools for package owners.