database

package
v0.0.0-...-7cfde4e Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	*sqlx.DB
}

func New

func New(dsn string, automigrate bool) (*DB, error)

func (*DB) DeletePasswordResets

func (db *DB) DeletePasswordResets(userID int) error

func (*DB) GetPasswordReset

func (db *DB) GetPasswordReset(hashedToken string) (*PasswordReset, error)

func (*DB) GetUser

func (db *DB) GetUser(id int) (*User, error)

func (*DB) GetUserByEmail

func (db *DB) GetUserByEmail(email string) (*User, error)

func (*DB) InsertPasswordReset

func (db *DB) InsertPasswordReset(hashedToken string, userID int, ttl time.Duration) error

func (*DB) InsertUser

func (db *DB) InsertUser(email, hashedPassword string) (int, error)

func (*DB) UpdateUserHashedPassword

func (db *DB) UpdateUserHashedPassword(id int, hashedPassword string) error

type PasswordReset

type PasswordReset struct {
	HashedToken string    `db:"hashed_token"`
	UserID      int       `db:"user_id"`
	Expiry      time.Time `db:"expiry"`
}

type User

type User struct {
	ID             int       `db:"id"`
	Created        time.Time `db:"created"`
	Email          string    `db:"email"`
	HashedPassword string    `db:"hashed_password"`
}

Jump to

Keyboard shortcuts

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