Documentation
¶
Index ¶
- func NewConfig(c Config) config
- type Config
- type Connection
- type ConnectionHook
- type Driver
- func (dr *Driver) AddLogger(logger model.Logger, err error) error
- func (dr *Driver) Close() error
- func (dr *Driver) DropColumn(schema, table, column string) error
- func (dr *Driver) DropTable(schema, table string) error
- func (dr *Driver) ErrorTranslator() func(err error) error
- func (dr *Driver) FormatTableName(schema, table string) string
- func (dr *Driver) GetDatabaseConfig() *model.DatabaseConfig
- func (dr *Driver) Init() error
- func (dr *Driver) KeywordHandler(s string) string
- func (dr *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 (dr *Driver) RenameColumn(schema, table, oldColumn, newColumn string) error
- func (dr *Driver) RenameTable(schema, table, newTable string) error
- func (dr *Driver) Stats() sql.DBStats
- func (dr *Driver) SupportsReturning() bool
- type ExecQuerierContext
- type SQLiteSchemaDriver
- func (p *SQLiteSchemaDriver) DiscoverFKs(ctx context.Context, table string) ([]model.FKRef, error)
- func (p *SQLiteSchemaDriver) DropTables(ctx context.Context, tables []string) error
- func (p *SQLiteSchemaDriver) GetColumns(ctx context.Context, table string) ([]model.ColumnDef, error)
- func (p *SQLiteSchemaDriver) GetForeignKeys(ctx context.Context, table string) ([]model.ForeignKeyDef, error)
- func (p *SQLiteSchemaDriver) GetIndexStats(_ context.Context) ([]model.IndexStat, error)
- func (p *SQLiteSchemaDriver) GetIndexes(ctx context.Context, table string) ([]model.IndexDef, error)
- func (p *SQLiteSchemaDriver) GetPrimaryKey(ctx context.Context, table string) ([]string, error)
- func (p *SQLiteSchemaDriver) GetTableRowCount(_ context.Context, _ string) (int64, error)
- func (p *SQLiteSchemaDriver) GetTableStats(_ context.Context) ([]model.TableStat, error)
- func (p *SQLiteSchemaDriver) GetVersion(_ context.Context) (string, error)
- func (p *SQLiteSchemaDriver) IsColumnNullable(ctx context.Context, table, column string) bool
- func (p *SQLiteSchemaDriver) ListTables(ctx context.Context) ([]string, error)
- func (p *SQLiteSchemaDriver) ListTablesInSchema(ctx context.Context, _ string) ([]string, error)
- func (p *SQLiteSchemaDriver) ResetSequence(_ context.Context, _ string, _ int64) error
- func (p *SQLiteSchemaDriver) SequenceExists(_ context.Context, _ string) (bool, error)
- func (p *SQLiteSchemaDriver) TruncateTable(ctx context.Context, table string) error
- 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.
}
Config contains SQLite driver configuration options.
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection represents a SQLite database connection.
func (Connection) ExecContext ¶
func (Connection) QueryContext ¶
func (Connection) QueryRowContext ¶
type ConnectionHook ¶
type ConnectionHook func( conn ExecQuerierContext, dsn string, ) error
ConnectionHook is a callback function called after each connection is opened.
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver implements the SQLite database driver.
func Open ¶
Open opens a sqlite connection. By default uses "PRAGMA foreign_keys = ON;" and "PRAGMA busy_timeout = 5000;".
func OpenInMemory ¶
func OpenInMemory(c config) (driver *Driver)
OpenInMemory opens a in memory database.
func (*Driver) DropColumn ¶
func (*Driver) ErrorTranslator ¶
func (*Driver) FormatTableName ¶
func (*Driver) GetDatabaseConfig ¶
func (dr *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 ¶
func (*Driver) SupportsReturning ¶
type ExecQuerierContext ¶
type ExecQuerierContext interface {
driver.ExecerContext
driver.QueryerContext
}
ExecQuerierContext combines ExecerContext and QueryerContext interfaces.
type SQLiteSchemaDriver ¶ added in v0.9.2
type SQLiteSchemaDriver struct {
// contains filtered or unexported fields
}
func NewSQLiteSchemaDriver ¶ added in v0.9.2
func (*SQLiteSchemaDriver) DiscoverFKs ¶ added in v0.9.2
func (*SQLiteSchemaDriver) DropTables ¶ added in v0.9.2
func (p *SQLiteSchemaDriver) DropTables(ctx context.Context, tables []string) error
func (*SQLiteSchemaDriver) GetColumns ¶ added in v0.9.2
func (*SQLiteSchemaDriver) GetForeignKeys ¶ added in v0.9.2
func (p *SQLiteSchemaDriver) GetForeignKeys(ctx context.Context, table string) ([]model.ForeignKeyDef, error)
func (*SQLiteSchemaDriver) GetIndexStats ¶ added in v0.9.2
func (*SQLiteSchemaDriver) GetIndexes ¶ added in v0.9.2
func (*SQLiteSchemaDriver) GetPrimaryKey ¶ added in v0.9.2
func (*SQLiteSchemaDriver) GetTableRowCount ¶ added in v0.9.2
func (*SQLiteSchemaDriver) GetTableStats ¶ added in v0.9.2
func (*SQLiteSchemaDriver) GetVersion ¶ added in v0.9.2
func (p *SQLiteSchemaDriver) GetVersion(_ context.Context) (string, error)
func (*SQLiteSchemaDriver) IsColumnNullable ¶ added in v0.9.2
func (p *SQLiteSchemaDriver) IsColumnNullable(ctx context.Context, table, column string) bool
func (*SQLiteSchemaDriver) ListTables ¶ added in v0.9.2
func (p *SQLiteSchemaDriver) ListTables(ctx context.Context) ([]string, error)
func (*SQLiteSchemaDriver) ListTablesInSchema ¶ added in v0.9.2
func (*SQLiteSchemaDriver) ResetSequence ¶ added in v0.9.2
func (*SQLiteSchemaDriver) SequenceExists ¶ added in v0.9.2
func (*SQLiteSchemaDriver) TruncateTable ¶ added in v0.9.2
func (p *SQLiteSchemaDriver) TruncateTable(ctx context.Context, table string) error
type SavePoint ¶
type SavePoint struct {
// contains filtered or unexported fields
}
SavePoint represents a transaction savepoint for partial rollbacks.
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction represents a SQLite database transaction.
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.