Documentation ¶
Index ¶
- func Execute[RESULT any](session octobe.Session[Builder], f Handler[RESULT]) (RESULT, error)
- func Open(ctx context.Context, dsn string, opts ...octobe.Option[config]) octobe.Open[postgres, config, Builder]
- func OpenWithPool(pool *pgx.Conn, opts ...octobe.Option[config]) octobe.Open[postgres, config, Builder]
- func WithTransaction(options TxOptions) octobe.Option[config]
- func WithoutTransaction() octobe.Option[config]
- type Builder
- type Driver
- type Handler
- type Segment
- type TxOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Execute ¶
Execute is a function that can be used for executing a handler with a session builder. This function injects the builder of the driver into the handler.
func Open ¶
func Open(ctx context.Context, dsn string, opts ...octobe.Option[config]) octobe.Open[postgres, config, Builder]
Open is a function that can be used for opening a new database connection, it should always return a driver with set signature of types for the local driver.
func OpenWithPool ¶
func OpenWithPool(pool *pgx.Conn, opts ...octobe.Option[config]) octobe.Open[postgres, config, Builder]
OpenWithPool is a function that can be used for opening a new database connection, it should always return a driver with set signature of types for the local driver. This function is used when a connection pool is already available.
func WithTransaction ¶
func WithTransaction(options TxOptions) octobe.Option[config]
WithTransaction enables the use of a transaction for the session, enforce the usage of commit and rollback.
func WithoutTransaction ¶
func WithoutTransaction() octobe.Option[config]
WithoutTransaction disables the use of a transaction for the session, this will not enforce the usage of commit and rollback.
Types ¶
type Handler ¶
Handler is a signature type for a handler. The handler receives a builder of the specific driver and returns a result and an error.
type Segment ¶
type Segment struct {
// contains filtered or unexported fields
}
Segment is a specific query that can be run only once it keeps a few fields for keeping track on the Segment
func (*Segment) Exec ¶
func (s *Segment) Exec() (pgconn.CommandTag, error)
Exec will execute a query. Used for inserts or updates