db

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection interface {
	Close()
	CreateUser(user *UserDB, hash string) error
	UpdateRefreshToken(userId uuid.UUID, refreshToken string, refreshTokenExpireAt time.Time) error
	LoginUser(user *UserDB) error
	CheckRefreshToken(userId uuid.UUID, refreshToken string) error
	UpdatePassword(userId uuid.UUID, password string, hash string) error
	DeleteUser(userId uuid.UUID) error
}

func NewConnection

func NewConnection() (Connection, error)

type PostgresConnection

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

func (*PostgresConnection) CheckRefreshToken

func (connection *PostgresConnection) CheckRefreshToken(userId uuid.UUID, refreshToken string) error

func (*PostgresConnection) Close

func (connection *PostgresConnection) Close()

func (*PostgresConnection) CreateUser

func (connection *PostgresConnection) CreateUser(user *UserDB, hash string) error

func (*PostgresConnection) DeleteUser

func (connection *PostgresConnection) DeleteUser(userId uuid.UUID) error

func (*PostgresConnection) LoginUser

func (connection *PostgresConnection) LoginUser(user *UserDB) error

func (*PostgresConnection) UpdatePassword

func (connection *PostgresConnection) UpdatePassword(userId uuid.UUID, password string, hash string) error

func (*PostgresConnection) UpdateRefreshToken

func (connection *PostgresConnection) UpdateRefreshToken(userId uuid.UUID, refreshToken string, refreshTokenExpireAt time.Time) error

type UserDB

type UserDB struct {
	ID        uuid.UUID `db:"id"`
	Password  string    `db:"password"`
	CreatedOn time.Time `db:"created_on"`
	LastLogin time.Time `db:"last_login"`
}

Jump to

Keyboard shortcuts

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