models

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Model modelInterface = &Server{}
)

Functions

This section is empty.

Types

type Auth

type Auth struct {
	ID       uint64 `gorm:"primary_key;auto_increment" json:"id"`
	UserID   uint64 `gorm:";not null;" json:"user_id"`
	AuthUUID string `gorm:"size:255;not null;" json:"auth_uuid"`
	Admin    int64  `gorm:"default:0", json:"admin"`
	Expires  int64  `gorm:";not_null;", json:"expires"`
}

type Server

type Server struct {
	DB *gorm.DB
}

func (*Server) AutoMigrate

func (s *Server) AutoMigrate(db *gorm.DB)

func (*Server) CreateAuth

func (s *Server) CreateAuth(userId uint64) (*Auth, error)

func (*Server) CreateUser

func (s *Server) CreateUser(user *User) (*User, error)

func (*Server) DeleteAuth

func (s *Server) DeleteAuth(authD *auth.AuthDetails) error

func (*Server) FetchAuth

func (s *Server) FetchAuth(authD *auth.AuthDetails) (*Auth, error)

func (*Server) GetUserByEmail

func (s *Server) GetUserByEmail(email string) (*User, error)

func (*Server) Initialize

func (s *Server) Initialize(db *gorm.DB)

func (*Server) IsAdmin

func (s *Server) IsAdmin(authD *auth.AuthDetails) bool

func (*Server) ValidateEmail

func (s *Server) ValidateEmail(email string) error

type User

type User struct {
	ID       uint64 `gorm:"primary_key;auto_increment" json:"id"`
	Email    string `gorm:"size:255;not null;unique" json:"email"`
	Password string `json:"password,omitempty"`
	Admin    int64  `gorm:"default:0" json:"admin"`
}

Jump to

Keyboard shortcuts

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