sqlite

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cmd

func Cmd(cmd string, args ...any) migrate.SQLCommand

Cmd is a function simplifying the creation of a Command.

func NewSteps added in v0.0.1

func NewSteps(name string) *migrate.Steps

NewSteps instantiates a new migration step sequence. The name should not be empty and ideally unique to the database as it is used to compute the root checksum identifying the database.

func NoTxF

func NoTxF(fs ...NoTxFunc) migrate.StepFunc

NoTxF returns a migration step function that executes the user provided functions in sequence without a wrapping transaction. It terminates as soon as a function returns an error. It doesn't execute any function when dryRun is true. The pseudo error ErrCancel is treated as ErrAbort as operations can't be cancelled and database version remains v1.

Use with care as any error in the function may leave the database is an undefined state.

func Open

func Open(sourceName string, options ...Option) (migrate.SQLDB, error)

Open opens or create an SQLite database.

func Tx

func Tx(cmds ...migrate.SQLCommand) migrate.StepFunc

Tx returns a migration step function that executes all the SQL commands in sequence wrapped in a transaction. The execution stops and rolls back as soon as an error is returned by one of the commands. It is also rolled back when dryRun is true.

Types

type Logger

type Logger = migrate.Logger

Logger is a migration logger.

type Migrator

type Migrator = migrate.Migrator

Migrator is a migration for migration steps.

func NewMigrator

func NewMigrator(db migrate.SQLDB, s migrate.Stepper, l migrate.Logger) (*Migrator, error)

New returns a new migrator.

type NoTxFunc

type NoTxFunc = migrate.NoTxFunc

NoTxFunc is an migrate.NoTxFunc.

type Option

type Option func(*config)

Option function.

func WithTableName

func WithTableName(tableName string) Option

WithTableName changes the default version table name.

type SQLDB

type SQLDB = migrate.SQLDB

SQLDB is a migration SQLDB.

type SQLTx

type SQLTx = migrate.SQLTx

SQLTx is a migration transaction.

type StepFunc

type StepFunc = migrate.StepFunc

StepFunc is a migration step function.

func NoTx

func NoTx(cmds ...migrate.SQLCommand) StepFunc

NoTx returns a migration step function that executes the SQL commands in sequence without a wrapping transaction. It terminates as soon as a command returns an error. It doesn't execute any cmds when dryRun is true.

func TxF

func TxF(fs ...TxFunc) StepFunc

TxF returns a migration step function that executes all the user provided functions in sequence wrapped in a transaction. The execution stops and rolls back as soon as an error is returned by one of the function and the step function returns the error.

A user function may return the ErrAbort pseudo error to force a termination of the function execution and the AllUp or AllDown execution which will return the ErrAbort error. To force a roll back of the transaction without terminating the execution of subsequent functions and migration steps, it must return the ErrCancel pseudo error. The migration step function will return nil as error.

type StepInfo

type StepInfo = migrate.StepInfo

StepInfo is a migration step information.

type Steps

type Steps = migrate.Steps

Steps are migration steps.

type TxFunc

type TxFunc = migrate.TxFunc

TxFunc is an migrate.TxFunc.

Jump to

Keyboard shortcuts

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