postgres

package
v0.0.0-...-90a23b5 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name, User, Password, Host string
	Port                       int
}

type DB

type DB struct {
	*sqlx.DB
}

DB represents the database

func NewWithWaitLoop

func NewWithWaitLoop(config Config) (*DB, error)

func (*DB) AccountWithCredentials

func (db *DB) AccountWithCredentials(email, password string) (*goapi.Account, error)

AccountWithCredentials returns an account if the email and password provided match an (email,password) pair in the db

func (*DB) AddAccount

func (db *DB) AddAccount(a *goapi.Account) (*goapi.Account, error)

AddAccount insert a new account in the database

func (*DB) AddSession

func (db *DB) AddSession(session *goapi.Session) (*goapi.Session, error)

AddSession creates a new session

func (*DB) CreateSession

func (db *DB) CreateSession(accountID uuid.UUID) (*goapi.Session, error)

CreateSession creates a new session

func (*DB) ExpireSessionFromToken

func (db *DB) ExpireSessionFromToken(token string) (*goapi.Session, error)

ExpireSessionFromToken expires the session with the given token

func (*DB) SessionFromToken

func (db *DB) SessionFromToken(token string) (*goapi.Session, error)

SessionFromToken fetches a session by its token

func (*DB) UpdateSession

func (db *DB) UpdateSession(token string) (*goapi.Session, error)

UpdateSession updates a session in the db with the current timestamp

Jump to

Keyboard shortcuts

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