picodata

package
v6.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoggerName = "picodata-driver"
)

Variables

View Source
var (
	ErrNativeUnsupported       = errors.New("NATIVE insert is not supported in Picodata yet")
	ErrTransactionsUnsupported = errors.New("transactions are not supported in Picodata yet")
)
View Source
var ErrUnsupportedType = errors.New("unsupported value type")

ErrUnsupportedType is returned when a query value has an unrecognized type.

Functions

This section is empty.

Types

type Driver

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

Driver implements the driver.Driver interface for Picodata DB.

func NewDriver

func NewDriver(
	ctx context.Context,
	opts driver.Options,
) (d *Driver, err error)

NewDriver creates a new Picodata driver instance.

func (*Driver) Begin

func (d *Driver) Begin(ctx context.Context, isolation config.TxIsolationLevel) (driver.Tx, error)

func (*Driver) ClassifyError

func (*Driver) ClassifyError(err error) driver.ErrorFacts

func (*Driver) Insert

func (d *Driver) Insert(
	ctx context.Context,
	req *driver.InsertRequest,
) (*stats.Query, error)

Insert runs a typed driver.InsertRequest through the picodata driver. Each worker prepares a gen.Cursor partition, adapts it to a source.RowSource, and drains it through runInsertChunk.

func (*Driver) PoolMaxConns added in v6.3.0

func (d *Driver) PoolMaxConns() int

func (*Driver) RunQuery

func (d *Driver) RunQuery(
	ctx context.Context,
	sql string,
	args map[string]any,
) (*driver.QueryResult, error)

RunQuery executes sql with named :arg placeholders and returns rows cursor.

func (*Driver) Teardown

func (d *Driver) Teardown(_ context.Context) error

Teardown closes the connection to Picodata.

type Executor

type Executor interface {
	Exec(ctx context.Context, sql string, args ...any) (pgconn.CommandTag, error)
	ExecContext(ctx context.Context, sql string, args ...any) (pgconn.CommandTag, error)
	Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
	QueryContext(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
	Ping(ctx context.Context) error
	Close()
	Config() *pgxpool.Config
}

type PicoDialect

type PicoDialect struct{}

PicoDialect implements sqlqueries.Dialect for Picodata via pgx.

func (PicoDialect) Convert

func (PicoDialect) Convert(val any) (any, error)

func (PicoDialect) Deduplicate

func (PicoDialect) Deduplicate() bool

func (PicoDialect) Placeholder

func (PicoDialect) Placeholder(index int) string

func (PicoDialect) StatementDeadline

func (PicoDialect) StatementDeadline(timeout time.Duration) time.Duration

StatementDeadline returns timeout unchanged; there is no server-side hint to outlast.

func (PicoDialect) StatementTimeoutHint

func (PicoDialect) StatementTimeoutHint(sql string, _ time.Duration) (string, bool)

StatementTimeoutHint returns sql unchanged; picodata honors context cancellation for its per-statement deadline.

type PoolX

type PoolX struct {
	*picodata.Pool
}

PoolX wraps *picodata.Pool and adds ExecContext/QueryContext to satisfy Executor.

func (*PoolX) ExecContext

func (p *PoolX) ExecContext(
	ctx context.Context,
	sql string,
	args ...any,
) (pgconn.CommandTag, error)

func (*PoolX) QueryContext

func (p *PoolX) QueryContext(ctx context.Context, sql string, args ...any) (pgx.Rows, error)

Jump to

Keyboard shortcuts

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