model

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidCredential = errors.New("invalid credential")

Functions

func Verify

func Verify(user uuid.UUID, pass string, tx *sql.Tx) error

Types

type Credential

type Credential struct {
	User uuid.UUID `json:"user,omitempty"`
	Hash [32]byte  `json:"-"`
	Salt [18]byte  `json:"-"`
}

func NewCredential

func NewCredential(plain string) (*Credential, error)

func (*Credential) Create

func (model *Credential) Create(tx *sql.Tx) error

func (*Credential) Delete

func (model *Credential) Delete(tx *sql.Tx) error

func (*Credential) Lookup

func (model *Credential) Lookup(_ *sql.Tx) error

func (*Credential) Update

func (model *Credential) Update(_ *sql.Tx) error

type Email

type Email struct {
	User    uuid.UUID `json:"user,omitempty"`
	Address string    `json:"address,omitempty"`
	Valid   bool      `json:"-"`
}

func NewEmail

func NewEmail(user uuid.UUID, address string) (*Email, error)

func (*Email) Create

func (model *Email) Create(tx *sql.Tx) error

func (*Email) Delete

func (model *Email) Delete(tx *sql.Tx) error

func (*Email) Lookup

func (model *Email) Lookup(tx *sql.Tx) error

func (*Email) Update

func (model *Email) Update(tx *sql.Tx) error

type Login

type Login struct {
	User  uuid.UUID `json:"user,omitempty"`
	Pass  string    `json:"-"`
	Email string    `json:"email,omitempty"`
	Phone string    `json:"phone,omitempty"`
}

func (*Login) Create

func (model *Login) Create(tx *sql.Tx) error

func (*Login) Delete

func (model *Login) Delete(tx *sql.Tx) error

func (*Login) Lookup

func (model *Login) Lookup(tx *sql.Tx) error

func (*Login) Update

func (model *Login) Update(_ *sql.Tx) error

type Model

type Model interface {
	Create(*sql.Tx) error
	Lookup(*sql.Tx) error
	Update(*sql.Tx) error
	Delete(*sql.Tx) error
}

type Phone

type Phone struct {
	User   uuid.UUID `json:"user,omitempty"`
	Number string    `json:"number,omitempty"`
	Valid  bool      `json:"-"`
}

func NewPhone

func NewPhone(user uuid.UUID, number string) (*Phone, error)

func (*Phone) Create

func (model *Phone) Create(tx *sql.Tx) error

func (*Phone) Delete

func (model *Phone) Delete(tx *sql.Tx) error

func (*Phone) Lookup

func (model *Phone) Lookup(tx *sql.Tx) error

func (*Phone) Update

func (model *Phone) Update(tx *sql.Tx) error

type Session

type Session struct {
	User    uuid.UUID  `json:"user,omitempty"`
	Token   []byte     `json:"token,omitempty"`
	Expires *time.Time `json:"expires,omitempty"`
	Revoked *time.Time `json:"revoked,omitempty"`
}

func (*Session) Create

func (model *Session) Create(tx *sql.Tx) error

func (*Session) Delete

func (model *Session) Delete(tx *sql.Tx) error

func (*Session) JWT

func (model *Session) JWT(audience ...string) *jwt.Token

func (*Session) Lookup

func (model *Session) Lookup(tx *sql.Tx) error

func (*Session) Update

func (model *Session) Update(_ *sql.Tx) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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