data

package
v0.0.0-...-5b4ecf2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRecordNotFound = errors.New("no record found")
	ErrDuplicateEmail = errors.New("duplicate email")
)

Functions

func ValidateEmail

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

func ValidateName

func ValidateName(v *validator.Validator, name string)

func ValidatePlainPassword

func ValidatePlainPassword(v *validator.Validator, plainPassword string)

Types

type Models

type Models struct {
	Users  UserModel
	Tokens StateTokenModel
}

func NewModels

func NewModels(db *sql.DB) Models

type StateToken

type StateToken struct {
	PlainText string
	Hash      []byte
	Expiry    time.Time
}

type StateTokenModel

type StateTokenModel struct {
	// contains filtered or unexported fields
}

func NewStateTokenModel

func NewStateTokenModel(db *sql.DB) *StateTokenModel

func (StateTokenModel) Insert

func (s StateTokenModel) Insert(token StateToken) error

func (StateTokenModel) New

type User

type User struct {
	ID        int64      `json:"id"`
	Name      string     `json:"name"`
	Email     string     `json:"email"`
	AvatarURL nullString `json:"avatar_url"`
	CreatedAt time.Time  `json:"created_at"`
}

type UserAuthProvider

type UserAuthProvider struct {
	UserID     int64
	Email      string
	Provider   string
	ProviderID string
}

type UserCredential

type UserCredential struct {
	UserID   int64
	Email    string
	Password password
}

type UserModel

type UserModel struct {
	// contains filtered or unexported fields
}

func (UserModel) GetByEmail

func (u UserModel) GetByEmail(email string) (UserWithCredential, error)

func (UserModel) Insert

func (u UserModel) Insert(user *UserWithCredential) error

type UserWithCredential

type UserWithCredential struct {
	User       User
	Credential UserCredential
}

Jump to

Keyboard shortcuts

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