data

package
v0.0.0-...-b2d045a Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicateEmail = errors.New("duplicate email")
)

Functions

func ValidateEmail

func ValidateEmail(v *validator.Validator, email string)

func ValidatePasswordPlaintext

func ValidatePasswordPlaintext(v *validator.Validator, password string)

func ValidateUser

func ValidateUser(v *validator.Validator, user *User)

Types

type Models

type Models struct {
	Users UserModel
}

func NewModels

func NewModels(dbpool *pgxpool.Pool) Models

type User

type User struct {
	ID         int64     `json:"id"`
	CreatedAt  time.Time `json:"created_at"`
	FirstName  string    `json:"first_name"`
	LastName   string    `json:"last_name"`
	Email      string    `json:"email"`
	Password   password  `json:"-"`
	Activated  bool      `json:"activated"`
	Department int       `json:"department"`
	Version    int       `json:"-"`
}

type UserModel

type UserModel struct {
	DBPool *pgxpool.Pool
}

func (UserModel) GetByEmail

func (m UserModel) GetByEmail(email string) (*User, error)

func (UserModel) Insert

func (m UserModel) Insert(user *User) error

func (UserModel) Update

func (m UserModel) Update(user *User) error

Jump to

Keyboard shortcuts

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