sqlite

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2020 License: MPL-2.0 Imports: 13 Imported by: 1

Documentation

Overview

Package sqlite is responsible for creation of encrypted sqlite3 database using sqlcipher driver. It is optimized for mobile usage as well.

sqlite package also provides a capability to apply bindata migration. You can keep your migrations close to your business logic and use this package to create an encrypted sqlite3 database and then apply the migrations easily.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyMigrations

func ApplyMigrations(db *sql.DB, assetNames []string, assetGetter func(name string) ([]byte, error)) error

ApplyMigrations allows to apply bindata migrations on the current *sql.DB. `assetNames` is a list of assets with migrations and `assetGetter` is responsible for returning the content of the asset with a given name.

func Migrate

func Migrate(database *sql.DB) error

func Open

func Open(path, key string) (*sql.DB, error)

Open opens or initializes a new database for a given file path. MigrationConfig is optional but if provided migrations are applied automatically.

func OpenInMemory

func OpenInMemory() (*sql.DB, error)

OpenInMemory opens an in memory SQLite database. Number of KDF iterations is reduced to 0.

func OpenWithIter

func OpenWithIter(path, key string, kdfIter int) (*sql.DB, error)

OpenWithIter allows to open a new database with a custom number of kdf iterations. Higher kdf iterations number makes it slower to open the database.

Types

type MigrationConfig

type MigrationConfig struct {
	AssetNames  []string
	AssetGetter func(name string) ([]byte, error)
}

MigrationConfig is a struct that allows to define bindata migrations.

Jump to

Keyboard shortcuts

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