Documentation
¶
Overview ¶
Package core contains Postgres database handle implementation details.
Index ¶
- func OperationError(operation string, err error) error
- func OperationErrorf(operation, format string, args ...any) error
- type Connection
- func (c *Connection) Begin(ctx context.Context) (*Transaction, error)
- func (c *Connection) Close() error
- func (c *Connection) Copy() runtime.Value
- func (c *Connection) Hash() uint64
- func (c *Connection) MarshalJSON() ([]byte, error)
- func (c *Connection) Query(ctx context.Context, q runtime.Query) (runtime.List, error)
- func (c *Connection) QueryCount(ctx context.Context, q runtime.Query) (runtime.Int, error)
- func (c *Connection) QueryExists(ctx context.Context, q runtime.Query) (runtime.Boolean, error)
- func (c *Connection) QueryOne(ctx context.Context, q runtime.Query) (runtime.Value, error)
- func (c *Connection) ResourceID() uint64
- func (c *Connection) String() string
- type OpenOptions
- type Transaction
- func (t *Transaction) Close() error
- func (t *Transaction) Commit() error
- func (t *Transaction) Copy() runtime.Value
- func (t *Transaction) Hash() uint64
- func (t *Transaction) MarshalJSON() ([]byte, error)
- func (t *Transaction) Query(ctx context.Context, q runtime.Query) (runtime.List, error)
- func (t *Transaction) QueryCount(ctx context.Context, q runtime.Query) (runtime.Int, error)
- func (t *Transaction) QueryExists(ctx context.Context, q runtime.Query) (runtime.Boolean, error)
- func (t *Transaction) QueryOne(ctx context.Context, q runtime.Query) (runtime.Value, error)
- func (t *Transaction) ResourceID() uint64
- func (t *Transaction) Rollback() error
- func (t *Transaction) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OperationError ¶
OperationError wraps an error with the DB::POSTGRES operation context.
func OperationErrorf ¶
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) QueryCount ¶
func (*Connection) QueryExists ¶
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 ¶
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) QueryCount ¶
func (*Transaction) QueryExists ¶
func (*Transaction) ResourceID ¶
func (t *Transaction) ResourceID() uint64
func (*Transaction) Rollback ¶
func (t *Transaction) Rollback() error
func (*Transaction) String ¶
func (t *Transaction) String() string
Click to show internal directories.
Click to hide internal directories.