core

package
v1.0.0-rc.9 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package core contains Postgres database handle implementation details.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OperationError

func OperationError(operation string, err error) error

OperationError wraps an error with the DB::POSTGRES operation context.

func OperationErrorf

func OperationErrorf(operation, format string, args ...any) error

OperationErrorf formats a DB::POSTGRES operation error.

Types

type Connection

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

Connection is an opaque Postgres database handle exposed to Ferret.

func NewConnection

func NewConnection(db *sql.DB) *Connection

NewConnection creates a tracked Postgres connection handle.

func Open

func Open(ctx context.Context, options OpenOptions) (*Connection, error)

Open opens a Postgres database connection from validated options.

func (*Connection) Begin

func (c *Connection) Begin(ctx context.Context) (*Transaction, error)

func (*Connection) Close

func (c *Connection) Close() error

func (*Connection) Copy

func (c *Connection) Copy() runtime.Value

func (*Connection) Hash

func (c *Connection) Hash() uint64

func (*Connection) MarshalJSON

func (c *Connection) MarshalJSON() ([]byte, error)

func (*Connection) Query

func (c *Connection) Query(ctx context.Context, q runtime.Query) (runtime.List, error)

func (*Connection) QueryCount

func (c *Connection) QueryCount(ctx context.Context, q runtime.Query) (runtime.Int, error)

func (*Connection) QueryExists

func (c *Connection) QueryExists(ctx context.Context, q runtime.Query) (runtime.Boolean, error)

func (*Connection) QueryOne

func (c *Connection) QueryOne(ctx context.Context, q runtime.Query) (runtime.Value, error)

func (*Connection) ResourceID

func (c *Connection) ResourceID() uint64

func (*Connection) String

func (c *Connection) String() string

type OpenOptions

type OpenOptions struct {
	URI      *string `json:"uri"`
	Host     *string `json:"host"`
	Port     *int    `json:"port"`
	Database *string `json:"database"`
	User     *string `json:"user"`
	Password *string `json:"password"`
	SSLMode  *string `json:"sslMode"`
}

OpenOptions configures Postgres database connections.

func DecodeOpenOptions

func DecodeOpenOptions(ctx context.Context, value runtime.Value) (OpenOptions, error)

DecodeOpenOptions decodes a Ferret options object into OpenOptions.

type Transaction

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

Transaction is an opaque Postgres transaction handle exposed to Ferret.

func NewTransaction

func NewTransaction(parent *Connection, tx *sql.Tx) *Transaction

NewTransaction creates a tracked Postgres transaction handle.

func (*Transaction) Close

func (t *Transaction) Close() error

func (*Transaction) Commit

func (t *Transaction) Commit() error

func (*Transaction) Copy

func (t *Transaction) Copy() runtime.Value

func (*Transaction) Hash

func (t *Transaction) Hash() uint64

func (*Transaction) MarshalJSON

func (t *Transaction) MarshalJSON() ([]byte, error)

func (*Transaction) Query

func (t *Transaction) Query(ctx context.Context, q runtime.Query) (runtime.List, error)

func (*Transaction) QueryCount

func (t *Transaction) QueryCount(ctx context.Context, q runtime.Query) (runtime.Int, error)

func (*Transaction) QueryExists

func (t *Transaction) QueryExists(ctx context.Context, q runtime.Query) (runtime.Boolean, error)

func (*Transaction) QueryOne

func (t *Transaction) QueryOne(ctx context.Context, q runtime.Query) (runtime.Value, error)

func (*Transaction) ResourceID

func (t *Transaction) ResourceID() uint64

func (*Transaction) Rollback

func (t *Transaction) Rollback() error

func (*Transaction) String

func (t *Transaction) String() string

Jump to

Keyboard shortcuts

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