user

package
v0.0.0-...-592cec2 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2023 License: LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const PostgresSessionTable = "\"badger.user_session\""
View Source
const PostgresUserTable = "\"badger.user\""

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgresStore

type PostgresStore struct {
	DB *sqlx.DB
}

func (*PostgresStore) ChangePassword

func (store *PostgresStore) ChangePassword(username string, password string) error

func (*PostgresStore) CheckPassword

func (store *PostgresStore) CheckPassword(username string, password string) bool

func (*PostgresStore) CheckSession

func (store *PostgresStore) CheckSession(username string, code string) (bool, error)

func (*PostgresStore) Create

func (store *PostgresStore) Create(username string, password string) (*User, error)

func (*PostgresStore) CreateSession

func (store *PostgresStore) CreateSession(username string) (*Session, error)

func (*PostgresStore) Delete

func (store *PostgresStore) Delete(username string) error

func (*PostgresStore) Get

func (store *PostgresStore) Get(username string) (*User, error)

func (*PostgresStore) HashPassword

func (store *PostgresStore) HashPassword(password string) (string, error)

type Session

type Session struct {
	Id        int       `db:"id"`
	UserId    uuid.UUID `db:"user_id"`
	Code      string    `db:"code"`
	ExpiresOn time.Time `db:"expires_on"`
}

type Store

type Store interface {
	Get(username string) (*User, error)
	Create(username string, password string) (*User, error)
	Delete(username string) error
	CheckPassword(username string, password string) bool
	//TODO: Remove the following?
	ChangePassword(username string, password string) error
	HashPassword(password string) (string, error)
	CheckSession(username string, code string) (bool, error)
	CreateSession(username string) (*Session, error)
}

type User

type User struct {
	Id           uuid.UUID `db:"id" json:"id"`
	Username     string    `db:"username" json:"username"`
	PasswordHash string    `db:"password_hash" json:"passwordHash"`
}

Jump to

Keyboard shortcuts

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