sqlite

package
v2.32.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 12 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectionString

func ConnectionString(u *url.URL) string

TODO: Confirm we aren't breaking anyone's expectations and rename this to connectionString, as it's not part of the public Driver interface.

func NewDriver

func NewDriver(config dbmate.DriverConfig) dbmate.Driver

NewDriver initializes the driver

Types

type Driver

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

Driver provides top level database functions

func (*Driver) CreateDatabase

func (drv *Driver) CreateDatabase() error

CreateDatabase creates the specified database

func (*Driver) CreateMigrationsTable

func (drv *Driver) CreateMigrationsTable(db *sql.DB) error

CreateMigrationsTable creates the schema migrations table

func (*Driver) DatabaseExists

func (drv *Driver) DatabaseExists() (bool, error)

DatabaseExists determines whether the database exists

func (*Driver) DeleteMigration

func (drv *Driver) DeleteMigration(db dbutil.Transaction, version string) error

DeleteMigration removes a migration record

func (*Driver) DropDatabase

func (drv *Driver) DropDatabase() error

DropDatabase drops the specified database (if it exists)

func (*Driver) DumpSchema

func (drv *Driver) DumpSchema(db *sql.DB, _ ...string) ([]byte, error)

DumpSchema returns the current database schema

func (*Driver) InsertMigration

func (drv *Driver) InsertMigration(db dbutil.Transaction, version string) error

InsertMigration adds a new migration record

func (*Driver) MigrationsTableExists

func (drv *Driver) MigrationsTableExists(db *sql.DB) (bool, error)

MigrationsTableExists checks if the schema_migrations table exists

func (*Driver) Open

func (drv *Driver) Open() (*sql.DB, error)

Open creates a new database connection

func (*Driver) Ping

func (drv *Driver) Ping() error

Ping verifies a connection to the database. Due to the way SQLite works, by testing whether the database is valid, it will automatically create the database if it does not already exist.

func (*Driver) QueryError added in v2.8.0

func (drv *Driver) QueryError(query string, err error) error

Return a normalized version of the driver-specific error type.

func (*Driver) SelectMigrations

func (drv *Driver) SelectMigrations(db *sql.DB, limit int) (map[string]bool, error)

SelectMigrations returns a list of applied migrations with an optional limit (in descending order)

Jump to

Keyboard shortcuts

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