Documentation
¶
Overview ¶
Package sqlite provides the SQLite dialect for dbmigrate.
Index ¶
- func Open(dsn string) (*sql.DB, error)
- func QuoteIdentifier(s string) string
- type SQLiteDialect
- func (s *SQLiteDialect) DropTableSQL(schema, table string) string
- func (s *SQLiteDialect) EnsureTableSQL(tableName string) string
- func (s *SQLiteDialect) ListTablesSQL() string
- func (s *SQLiteDialect) Lock(ctx context.Context, db *sql.DB) (func() error, error)
- func (s *SQLiteDialect) Name() string
- func (d *SQLiteDialect) QuoteIdentifier(s string) string
- func (s *SQLiteDialect) TimestampDefault() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Open ¶
Open returns an *sql.DB for the given SQLite DSN. Examples: "file:./app.db", ":memory:", "file::memory:?cache=shared".
func QuoteIdentifier ¶
QuoteIdentifier quotes a SQLite identifier defensively.
Types ¶
type SQLiteDialect ¶
type SQLiteDialect struct{}
SQLiteDialect implements dbmigrate.Dialect for SQLite.
func (*SQLiteDialect) DropTableSQL ¶
func (s *SQLiteDialect) DropTableSQL(schema, table string) string
DropTableSQL returns SQL to drop the named table.
func (*SQLiteDialect) EnsureTableSQL ¶
func (s *SQLiteDialect) EnsureTableSQL(tableName string) string
EnsureTableSQL returns the CREATE TABLE statement for the tracking table.
func (*SQLiteDialect) ListTablesSQL ¶
func (s *SQLiteDialect) ListTablesSQL() string
ListTablesSQL returns the query used by Fresh to list user tables.
func (*SQLiteDialect) Lock ¶
Lock uses BEGIN IMMEDIATE on a dedicated connection. SQLite has no advisory locks, so an exclusive writer lock on the connection serializes migrators. The connection is left in an unlocked state while the table is created so that subsequent operations on the pool work normally; a transaction started with BEGIN IMMEDIATE would pin all work to that one connection and prevent other goroutines from using the pool.
func (*SQLiteDialect) QuoteIdentifier ¶
func (d *SQLiteDialect) QuoteIdentifier(s string) string
QuoteIdentifier quotes an identifier with double quotes.
func (*SQLiteDialect) TimestampDefault ¶
func (s *SQLiteDialect) TimestampDefault() string
TimestampDefault returns the SQLite current-timestamp expression.