psql

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInternalDBErr       = errors.New("an error occurred that was not possible to recover from")
	ErrNoRowWithIdentifier = errors.New("could not find requested row in database")
)

Functions

func CreatePooledConnection

func CreatePooledConnection(ctx context.Context, uri string) (*pgxpool.Pool, error)

Types

type Postgres

type Postgres struct {
	Queries *database.Queries
	// contains filtered or unexported fields
}

func NewPostgres

func NewPostgres(dbPool *pgxpool.Pool) Postgres

func (Postgres) BeginTx

func (p Postgres) BeginTx(ctx context.Context) (pgx.Tx, error)

func (Postgres) DeleteTokenByHash

func (p Postgres) DeleteTokenByHash(ctx context.Context, hash string) error

func (Postgres) InsertToken

func (p Postgres) InsertToken(
	ctx context.Context,
	hash string,
	expiresAt time.Time,
	metaData []byte,
) error

func (Postgres) InsertUser

func (p Postgres) InsertUser(
	ctx context.Context,
	data models.User,
	hashedPassword string,
) (models.User, error)

func (Postgres) QueryTokenByHash

func (p Postgres) QueryTokenByHash(ctx context.Context, hash string) (database.Token, error)

func (Postgres) QueryUserByEmail

func (p Postgres) QueryUserByEmail(
	ctx context.Context,
	email string,
) (models.User, error)

func (Postgres) QueryUserByID

func (p Postgres) QueryUserByID(
	ctx context.Context,
	id uuid.UUID,
) (models.User, error)

func (Postgres) UpdateUser

func (p Postgres) UpdateUser(
	ctx context.Context,
	data models.User,
) (models.User, error)

func (Postgres) UpdateUserPassword

func (p Postgres) UpdateUserPassword(
	ctx context.Context,
	userID uuid.UUID,
	newPassword string,
	updatedAt time.Time,
) error

func (Postgres) VerifyUserEmail

func (p Postgres) VerifyUserEmail(
	ctx context.Context,
	updatedAt time.Time,
	email string,
) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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