Documentation
¶
Index ¶
- func NewConfig(c Config) config
- type Config
- type Connection
- type ConnectionHook
- type Driver
- func (dr *Driver) Close() error
- func (db *Driver) DropColumn(schema, table, column string) error
- func (db *Driver) DropTable(schema, table string) error
- func (dr *Driver) ErrorTranslator() func(err error) error
- func (d *Driver) GetDatabaseConfig() *model.DatabaseConfig
- func (dr *Driver) Init() error
- func (dr *Driver) KeywordHandler(s string) string
- func (db *Driver) MigrateContext(ctx context.Context, migrator *model.Migrator) error
- func (dr *Driver) Name() string
- func (dr *Driver) NewConnection() model.Connection
- func (dr *Driver) NewTransaction(ctx context.Context, opts *sql.TxOptions) (model.Transaction, error)
- func (db *Driver) RenameColumn(schema, table, oldColumn, newColumn string) error
- func (db *Driver) RenameTable(schema, table, newTable string) error
- func (dr *Driver) Stats() sql.DBStats
- type ExecQuerierContext
- type Row
- type Rows
- type SavePoint
- type Transaction
- func (t Transaction) Commit() error
- func (t Transaction) ExecContext(ctx context.Context, query *model.Query) error
- func (t Transaction) QueryContext(ctx context.Context, query *model.Query) (model.Rows, error)
- func (t Transaction) QueryRowContext(ctx context.Context, query *model.Query) model.Row
- func (t Transaction) Rollback() error
- func (t Transaction) SavePoint() (model.SavePoint, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Logger model.Logger
IncludeArguments bool // include all arguments used on query
QueryThreshold time.Duration // query threshold to warning on slow queries
MigratePath string // output sql file, if defined the driver will not auto apply the migration.
ConnectionHook ConnectionHook // ConnectionHook is called after each connection is opened.
}
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func (Connection) ExecContext ¶
func (Connection) QueryContext ¶
func (Connection) QueryRowContext ¶
type ConnectionHook ¶ added in v0.5.0
type ConnectionHook func( conn ExecQuerierContext, dsn string, ) error
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
func Open ¶
Open opens a sqlite connection. By default uses "PRAGMA foreign_keys = ON;" and "PRAGMA busy_timeout = 5000;".
func OpenInMemory ¶ added in v0.5.0
func OpenInMemory(c config) (driver *Driver)
OpenInMemory opens a in memory database.
func (*Driver) DropColumn ¶
func (*Driver) ErrorTranslator ¶ added in v0.5.0
func (*Driver) GetDatabaseConfig ¶ added in v0.2.0
func (d *Driver) GetDatabaseConfig() *model.DatabaseConfig
func (*Driver) KeywordHandler ¶
func (*Driver) MigrateContext ¶
func (*Driver) NewConnection ¶
func (dr *Driver) NewConnection() model.Connection
func (*Driver) NewTransaction ¶
func (*Driver) RenameColumn ¶
func (*Driver) RenameTable ¶ added in v0.4.0
type ExecQuerierContext ¶ added in v0.5.0
type ExecQuerierContext interface {
driver.ExecerContext
driver.QueryerContext
}
type SavePoint ¶ added in v0.5.2
type SavePoint struct {
// contains filtered or unexported fields
}
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
func (Transaction) Commit ¶
func (t Transaction) Commit() error
func (Transaction) ExecContext ¶
func (Transaction) QueryContext ¶
func (Transaction) QueryRowContext ¶
func (Transaction) Rollback ¶
func (t Transaction) Rollback() error
Click to show internal directories.
Click to hide internal directories.