sqliteutil

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: MIT Imports: 7 Imported by: 0

README

sqliteutil

Transactions

Simplify transactions using WithTx.

Migrations

Put your migrations into a directory, for example migrations, ordered by name (YYYY-MM-DD prefix, for example). Embed the directory and pass it to the Migrate function:

//go:embed migrations
var migrations embed.FS

func init() {
    Migrate(db, migrations) // Check the error, of course.
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrIsDuplicate added in v0.6.0

func ErrIsDuplicate(err error) bool

func Migrate

func Migrate(db *sql.DB, migrationFS embed.FS) error

func WithTx

func WithTx(db *sql.DB, fn func(*sql.Tx) error) error

This is a convenience function to run a function within a transaction.

Types

This section is empty.

Jump to

Keyboard shortcuts

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