Documentation ¶
Index ¶
- Variables
- func Create(ctx context.Context, client Client, statement *sq.InsertBuilder) error
- func Delete(ctx context.Context, client Client, statement sq.DeleteBuilder) error
- func DoWithAttempts(fn func() error, maxAttempts int, delay time.Duration) error
- func ErrCommit(err error) error
- func ErrCreateQuery(err error) error
- func ErrCreateTx(err error) error
- func ErrDoQuery(err error) error
- func ErrExec(err error) error
- func ErrFieldNotFound(fieldName string) error
- func ErrNoRowForID(id string) error
- func ErrNoRowForTableUpdated() error
- func ErrNoRowForURL(url string) error
- func ErrNoRowForUpdatedAt(id string) error
- func ErrNoRows() error
- func ErrRollback(err error) error
- func ErrScan(err error) error
- func Get(ctx context.Context, client Client, statement sq.SelectBuilder) (pgx.Rows, error)
- func List(ctx context.Context, client Client, statement sq.SelectBuilder) (pgx.Rows, error)
- func MaxSortOrder(ctx context.Context, client Client, qb sq.StatementBuilderType, ...) (*uint64, error)
- func NewClient(ctx context.Context, maxAttempts int, maxDelay time.Duration, config *Config, ...) (pool *pgxpool.Pool, err error)
- func ParsePgError(err error) error
- func PrettySQL(q string) string
- func TableIndexCount(ctx context.Context, client Client, statement sq.SelectBuilder) (*uint64, error)
- func Update(ctx context.Context, client Client, statement sq.UpdateBuilder) error
- func UpdatedAt(ctx context.Context, client Client, statement sq.SelectBuilder) (*time.Time, error)
- type Client
- type Config
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNothingInserted = errors.New("nothing inserted")
)
Functions ¶
func DoWithAttempts ¶
func ErrCreateQuery ¶
func ErrCreateTx ¶
func ErrDoQuery ¶
func ErrFieldNotFound ¶
func ErrNoRowForID ¶
func ErrNoRowForTableUpdated ¶
func ErrNoRowForTableUpdated() error
func ErrNoRowForURL ¶
func ErrNoRowForUpdatedAt ¶
func ErrRollback ¶
func MaxSortOrder ¶
func NewClient ¶
func NewClient( ctx context.Context, maxAttempts int, maxDelay time.Duration, config *Config, binary bool, ) (pool *pgxpool.Pool, err error)
NewClient creates new postgres client.
func ParsePgError ¶
func TableIndexCount ¶
Types ¶
type Client ¶
type Client interface { Close() Acquire(ctx context.Context) (*pgxpool.Conn, error) AcquireFunc(ctx context.Context, f func(*pgxpool.Conn) error) error AcquireAllIdle(ctx context.Context) []*pgxpool.Conn Stat() *pgxpool.Stat Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error) Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error) QueryRow(ctx context.Context, sql string, args ...any) pgx.Row Begin(ctx context.Context) (pgx.Tx, error) BeginTx(ctx context.Context, txOptions pgx.TxOptions) (pgx.Tx, error) }
Click to show internal directories.
Click to hide internal directories.