pg

package
v0.0.0-...-26b8432 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(databaseURL string) error

Migrate takes care of executing the migrations on the database identified by the given databaseURL.

func NewPGStore

func NewPGStore(ctx context.Context, databaseURL string) (userz.Store, error)

Types

type PGCondition

type PGCondition[T userz.Conditionable] userz.Cond[T]

func (*PGCondition[T]) Evaluate

func (c *PGCondition[T]) Evaluate(field string) (any, error)

func (*PGCondition[T]) Hash

func (c *PGCondition[T]) Hash(field string) (string, error)

type PGIterator

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

func (*PGIterator) Len

func (i *PGIterator) Len() userz.PaginationData

func (*PGIterator) Next

func (i *PGIterator) Next(ctx context.Context) ([]*userz.User, error)

type PGPooledConn

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

PGPooledConn wraps a github.com/jackc/pgx/v4/pgxpool.Pool and implements the db interface.

func (*PGPooledConn) Begin

func (c *PGPooledConn) Begin(ctx context.Context) (pgx.Tx, error)

func (*PGPooledConn) Exec

func (c *PGPooledConn) Exec(ctx context.Context, statement string, params ...interface{}) (pgconn.CommandTag, error)

func (*PGPooledConn) Prepare

func (c *PGPooledConn) Prepare(ctx context.Context, name, statement string) (*pgconn.StatementDescription, error)

func (*PGPooledConn) Query

func (c *PGPooledConn) Query(ctx context.Context, statement string, params ...interface{}) (pgx.Rows, error)

func (*PGPooledConn) QueryRow

func (c *PGPooledConn) QueryRow(ctx context.Context, statement string, params ...interface{}) pgx.Row

type PGStore

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

PGStore is the implementation of the store with a postgresql backend.

func (*PGStore) Add

func (s *PGStore) Add(ctx context.Context, user *userz.UserData) (*userz.User, error)

func (*PGStore) List

func (s *PGStore) List(ctx context.Context, filter *userz.Filter, pageSize uint) (userz.Iterator[[]*userz.User], error)

func (*PGStore) Page

func (s *PGStore) Page(ctx context.Context, filter *userz.Filter, params *userz.PageParams) ([]*userz.User, error)

func (*PGStore) Remove

func (s *PGStore) Remove(ctx context.Context, id string) (*userz.User, error)

func (*PGStore) Update

func (s *PGStore) Update(ctx context.Context, id string, user *userz.UserData) (*userz.User, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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