persistenceutil

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 12 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultMigrations = []Migration{
	{
		Names:  nodemigrations.AssetNames(),
		Getter: nodemigrations.Asset,
	},
	{
		Names:  peersmigrations.AssetNames(),
		Getter: peersmigrations.Asset,
	},
	{
		Names:  statemigrations.AssetNames(),
		Getter: statemigrations.Asset,
	},
	{
		Names:  storemigrations.AssetNames(),
		Getter: storemigrations.Asset,
	},
}

DefaultMigrations is a collection of all mvds components migrations.

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(db *sql.DB) error

Migrate migrates a provided sqldb

func Open

func Open(path, key string, mc ...MigrationConfig) (*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 OpenWithIter

func OpenWithIter(path, key string, kdfIter int, mc ...MigrationConfig) (*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 Migration

type Migration struct {
	Names  []string
	Getter func(name string) ([]byte, error)
}

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