jsonb

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateRow

type CreateRow struct {
	ID        pgtype.UUID        `json:"id"`
	Data      []byte             `json:"data"`
	Metadata  []byte             `json:"metadata"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
}

type DBQuerier

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

func NewQuerier

func NewQuerier(conn genericConn) *DBQuerier

NewQuerier creates a DBQuerier that implements Querier. conn is typically *pgx.Conn, pgx.Tx, or *pgxpool.Pool.

func (*DBQuerier) Create

func (q *DBQuerier) Create(ctx context.Context, data []byte, metadata []byte) (CreateRow, error)

Create implements Querier.Create.

func (*DBQuerier) CreateBatch

func (q *DBQuerier) CreateBatch(batch genericBatch, data []byte, metadata []byte)

CreateBatch implements Querier.CreateBatch.

func (*DBQuerier) CreateScan

func (q *DBQuerier) CreateScan(results pgx.BatchResults) (CreateRow, error)

CreateScan implements Querier.CreateScan.

func (*DBQuerier) FindByID

func (q *DBQuerier) FindByID(ctx context.Context, id pgtype.UUID) (FindByIDRow, error)

FindByID implements Querier.FindByID.

func (*DBQuerier) FindByIDBatch

func (q *DBQuerier) FindByIDBatch(batch genericBatch, id pgtype.UUID)

FindByIDBatch implements Querier.FindByIDBatch.

func (*DBQuerier) FindByIDScan

func (q *DBQuerier) FindByIDScan(results pgx.BatchResults) (FindByIDRow, error)

FindByIDScan implements Querier.FindByIDScan.

func (*DBQuerier) ListAll

func (q *DBQuerier) ListAll(ctx context.Context) ([]ListAllRow, error)

ListAll implements Querier.ListAll.

func (*DBQuerier) ListAllBatch

func (q *DBQuerier) ListAllBatch(batch genericBatch)

ListAllBatch implements Querier.ListAllBatch.

func (*DBQuerier) ListAllScan

func (q *DBQuerier) ListAllScan(results pgx.BatchResults) ([]ListAllRow, error)

ListAllScan implements Querier.ListAllScan.

type FindByIDRow

type FindByIDRow struct {
	ID        pgtype.UUID        `json:"id"`
	Data      []byte             `json:"data"`
	Metadata  []byte             `json:"metadata"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
}

type ListAllRow

type ListAllRow struct {
	ID        pgtype.UUID        `json:"id"`
	Data      []byte             `json:"data"`
	Metadata  []byte             `json:"metadata"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
}

type Querier

type Querier interface {
	FindByID(ctx context.Context, id pgtype.UUID) (FindByIDRow, error)
	// FindByIDBatch enqueues a FindByID query into batch to be executed
	// later by the batch.
	FindByIDBatch(batch genericBatch, id pgtype.UUID)
	// FindByIDScan scans the result of an executed FindByIDBatch query.
	FindByIDScan(results pgx.BatchResults) (FindByIDRow, error)

	Create(ctx context.Context, data []byte, metadata []byte) (CreateRow, error)
	// CreateBatch enqueues a Create query into batch to be executed
	// later by the batch.
	CreateBatch(batch genericBatch, data []byte, metadata []byte)
	// CreateScan scans the result of an executed CreateBatch query.
	CreateScan(results pgx.BatchResults) (CreateRow, error)

	ListAll(ctx context.Context) ([]ListAllRow, error)
	// ListAllBatch enqueues a ListAll query into batch to be executed
	// later by the batch.
	ListAllBatch(batch genericBatch)
	// ListAllScan scans the result of an executed ListAllBatch query.
	ListAllScan(results pgx.BatchResults) ([]ListAllRow, error)
}

Querier is a typesafe Go interface backed by SQL queries.

Methods ending with Batch enqueue a query to run later in a pgx.Batch. After calling SendBatch on pgx.Conn, pgxpool.Pool, or pgx.Tx, use the Scan methods to parse the results.

Jump to

Keyboard shortcuts

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