Documentation
¶
Index ¶
- Constants
- func CtxWithWriterOverride(parent context.Context) context.Context
- type Database
- type MySQL
- type Postgres
- type SQL
- func (ds SQL) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (ds SQL) GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (ds SQL) NamedExecContext(ctx context.Context, query string, arg interface{}) (sql.Result, error)
- func (ds SQL) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
- func (ds SQL) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (ds SQL) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
- func (ds SQL) SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (ds SQL) WithinTransaction(ctx context.Context, txFunc func(txCtx context.Context) error) error
- type SQLRepository
- type SQLite
- type SqlQueryable
- type SqlTx
- func (q SqlTx) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (q SqlTx) GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (q SqlTx) NamedExecContext(ctx context.Context, query string, arg interface{}) (sql.Result, error)
- func (q SqlTx) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
- func (q SqlTx) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (q SqlTx) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
- func (q SqlTx) SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
Constants ¶
View Source
const ( TypeMySQL = "mysql" TypePostgres = "postgres" TypeSQLite = "sqlite" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MySQL ¶
type MySQL struct {
SQL
Config config.MySQLConfig
}
func NewMySQL ¶
func NewMySQL(config config.MySQLConfig) *MySQL
type Postgres ¶ added in v0.4.0
type Postgres struct {
SQL
Config config.PostgresConfig
}
func NewPostgres ¶ added in v0.4.0
func NewPostgres(config config.PostgresConfig) *Postgres
type SQL ¶
type SQL struct {
Writer *sqlx.DB
Reader *sqlx.DB
WriterHostname string
ReaderHostname string
DatabaseName string
}
Wrapper around a sql database with support for a writer + reader pool and the ability to start txns.
func (SQL) ExecContext ¶
func (SQL) GetContext ¶
func (SQL) NamedExecContext ¶
func (SQL) PrepareContext ¶
func (SQL) QueryContext ¶
func (SQL) QueryRowContext ¶
func (SQL) SelectContext ¶
type SQLRepository ¶
type SQLRepository struct {
DB *SQL
}
func NewSQLRepository ¶
func NewSQLRepository(db *SQL) SQLRepository
type SQLite ¶ added in v0.11.0
type SQLite struct {
SQL
Config config.SQLiteConfig
}
func NewSQLite ¶ added in v0.11.0
func NewSQLite(config config.SQLiteConfig) *SQLite
type SqlQueryable ¶
type SqlQueryable interface {
ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
NamedExecContext(ctx context.Context, query string, arg interface{}) (sql.Result, error)
PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
}
type SqlTx ¶
Encapsulates a sql transaction for an atomic write op
func (SqlTx) ExecContext ¶
func (SqlTx) GetContext ¶
func (SqlTx) NamedExecContext ¶
func (SqlTx) PrepareContext ¶
func (SqlTx) QueryContext ¶
func (SqlTx) QueryRowContext ¶
Click to show internal directories.
Click to hide internal directories.