postgres

package
v0.0.0-...-b69c308 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Timestamp dbx.ColumnType = "TIMESTAMPTZ"
	String    dbx.ColumnType = "TEXT"
	StringArr dbx.ColumnType = "TEXT[]"
	IntArr    dbx.ColumnType = "INTEGER[]"
	ByteA     dbx.ColumnType = "BYTEA"
	Int4      dbx.ColumnType = "INTEGER"
	Int8      dbx.ColumnType = "BIGINT"
	Float4    dbx.ColumnType = "REAL"
	Float8    dbx.ColumnType = "DOUBLE PRECISION"
	Bool      dbx.ColumnType = "BOOLEAN"
	JSONB     dbx.ColumnType = "JSONB"
)

Variables

This section is empty.

Functions

func InsertBuilder

func InsertBuilder[T any](db dbx.Database[T], mapp M) squirrel.InsertBuilder

func New

func New[T any](ctx context.Context, conf *confpb.Config,
	opts ...dbx.Option) (dbx.Database[T], error)

func Paging

func SelectBuilder

func SelectBuilder[T any](db dbx.Database[T],
	page *typepb.Pages, columns ...string) squirrel.SelectBuilder

func UpdateBuilder

func UpdateBuilder[T any](
	db dbx.Database[T], id string) squirrel.UpdateBuilder

func WithTx

func WithTx[T any](ss *TxSession, db dbx.Database[T]) dbx.Database[T]

Types

type Client

type Client interface {
	Exec(ctx context.Context, sql string,
		args ...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
}

type M

type M map[string]any

type Tx

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

func NewTX

func NewTX(conf *confpb.Config) *Tx

func NewTXMock

func NewTXMock(tx pgx.Tx) *Tx

func (*Tx) Begin

func (t *Tx) Begin(ctx context.Context) (*TxSession, error)

type TxSession

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

func (*TxSession) Commit

func (ts *TxSession) Commit(ctx context.Context) error

Commit implements database.Transaction.

func (*TxSession) Rollback

func (ts *TxSession) Rollback(ctx context.Context) error

Rollback implements database.Transaction.

Jump to

Keyboard shortcuts

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