sqlite

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package sqlite provides the SQLite dialect for dbmigrate.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(dsn string) (*sql.DB, error)

Open returns an *sql.DB for the given SQLite DSN. Examples: "file:./app.db", ":memory:", "file::memory:?cache=shared".

func QuoteIdentifier

func QuoteIdentifier(s string) string

QuoteIdentifier quotes a SQLite identifier defensively.

Types

type SQLiteDialect

type SQLiteDialect struct{}

SQLiteDialect implements dbmigrate.Dialect for SQLite.

func Dialect

func Dialect() *SQLiteDialect

Dialect returns the SQLite dialect for dbmigrate.

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

func (s *SQLiteDialect) Lock(ctx context.Context, db *sql.DB) (func() error, error)

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) Name

func (s *SQLiteDialect) Name() string

Name returns the dialect name.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL