Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶ added in v0.1.0
type Config interface {
// DriverName returns the name of the sql database driver.
DriverName() string
// DSN returns a connection string.
DSN() string
}
Config contains the information to connect to an sql database.
type DB ¶
type DB interface {
Begin(ctx context.Context, opts *TxOptions) (Tx, error)
Exec(ctx context.Context, query string, args ...interface{}) (Result, error)
Prepare(ctx context.Context, query string) (Stmt, error)
Query(ctx context.Context, query string, args ...interface{}) (*Rows, error)
QueryRow(ctx context.Context, query string, args ...interface{}) *Row
Close() error
Ping(ctx context.Context) error
}
type Migration ¶ added in v0.8.0
Migration defines a function type to validate and migrate the DB schema.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option sets options such as instumenting the DB with logging.
func WithMigration ¶ added in v0.8.0
WithMigration returns an Option that performs a migration against the DB.
type Tx ¶
type Tx interface {
Exec(ctx context.Context, query string, args ...interface{}) (Result, error)
Prepare(ctx context.Context, query string) (Stmt, error)
Query(ctx context.Context, query string, args ...interface{}) (*Rows, error)
QueryRow(ctx context.Context, query string, args ...interface{}) *Row
Commit() error
Rollback() error
Stmt(ctx context.Context, stmt Stmt) Stmt
}
Click to show internal directories.
Click to hide internal directories.