usermodel

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	Userid    string `query:"userid,getgroup;getgroupeq,userid|arr"`
	Username  string `query:"username"`
	Email     string `query:"email"`
	FirstName string `query:"first_name"`
	LastName  string `query:"last_name"`
}

Info is the metadata of a user

type Model

type Model struct {
	Userid       string `model:"userid,VARCHAR(31) PRIMARY KEY" query:"userid,getoneeq,userid;updeq,userid;deleq,userid"`
	Username     string `model:"username,VARCHAR(255) NOT NULL UNIQUE" query:"username,getoneeq,username"`
	PassHash     string `model:"pass_hash,VARCHAR(255) NOT NULL" query:"pass_hash"`
	Email        string `model:"email,VARCHAR(255) NOT NULL UNIQUE" query:"email,getoneeq,email"`
	FirstName    string `model:"first_name,VARCHAR(255) NOT NULL" query:"first_name"`
	LastName     string `model:"last_name,VARCHAR(255) NOT NULL" query:"last_name"`
	CreationTime int64  `model:"creation_time,BIGINT NOT NULL" query:"creation_time"`
}

Model is the db User model

type Repo

type Repo interface {
	New(username, password, email, firstname, lastname string) (*Model, error)
	NewEmpty() Model
	NewEmptyPtr() *Model
	ValidatePass(password string, m *Model) (bool, error)
	RehashPass(m *Model, password string) error
	GetGroup(limit, offset int) ([]Info, error)
	GetBulk(userids []string) ([]Info, error)
	GetByID(userid string) (*Model, error)
	GetByUsername(username string) (*Model, error)
	GetByEmail(email string) (*Model, error)
	Insert(m *Model) error
	Update(m *Model) error
	Delete(m *Model) error
	Setup() error
}

Repo is a user repository

func New

func New(database db.Database) Repo

New creates a new user repository

Jump to

Keyboard shortcuts

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