sqlite3

package
v4.6.4 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 10 Imported by: 0

README

sqlite3

sqlite3://path/to/database?query

Unlike other migrate database drivers, the sqlite3 driver will automatically wrap each migration in an implicit transaction by default. Migrations must not contain explicit BEGIN or COMMIT statements. This behavior may change in a future major release. (See below for a workaround.)

Refer to upstream documentation for a complete list of query parameters supported by the sqlite3 database driver. The auxiliary query parameters listed below may be supplied to tailor migrate behavior. All auxiliary query parameters are optional.

URL Query WithInstance Config Description
x-migrations-table MigrationsTable Name of the migrations table. Defaults to schema_migrations.
x-no-tx-wrap NoTxWrap Disable implicit transactions when true. Migrations may, and should, contain explicit BEGIN and COMMIT statements.

Notes

  • Uses the github.com/mattn/go-sqlite3 sqlite db driver (cgo)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDatabaseDirty  = fmt.Errorf("database is dirty")
	ErrNilConfig      = fmt.Errorf("no config")
	ErrNoDatabaseName = fmt.Errorf("no database name")
)
View Source
var DefaultMigrationsTable = "schema_migrations"

Functions

func WithInstance

func WithInstance(instance *sql.DB, config *Config) (database.Driver, error)

Types

type Config

type Config struct {
	MigrationsTable string
	DatabaseName    string
	NoTxWrap        bool
}

type Sqlite

type Sqlite struct {
	// contains filtered or unexported fields
}

func (*Sqlite) Close

func (m *Sqlite) Close() error

func (*Sqlite) Drop

func (m *Sqlite) Drop() (err error)

func (*Sqlite) Lock

func (m *Sqlite) Lock() error

func (*Sqlite) Open

func (m *Sqlite) Open(url string) (database.Driver, error)

func (*Sqlite) Run

func (m *Sqlite) Run(migration io.Reader) error

func (*Sqlite) SetVersion

func (m *Sqlite) SetVersion(version int, dirty bool) error

func (*Sqlite) Unlock

func (m *Sqlite) Unlock() error

func (*Sqlite) Version

func (m *Sqlite) Version() (version int, dirty bool, err error)

Jump to

Keyboard shortcuts

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