database

package
v0.23.4 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DialectExecutor

type DialectExecutor interface {
	// Setup is called on the dialect on initialization, returns the DSN (modified if necessary) to use for migrations
	Setup(context.Context) (string, error)

	// Identifier returns a unique identifier for the database if possible, or "", false
	Identifier(context.Context) (string, bool)

	// Validate is called before startup to check that the dialect can execute properly. If returns true and error is set, the error is merely logged.
	Validate(context.Context) (bool, error)

	// Prepare is called before migrations and upgrades are run
	Prepare(context.Context) error

	// Finalize is called after migrations and upgrades are run, with the resulting error. This function can modify the returning error from the migrator.
	Finalize(context.Context, error) error
}

type SimpleStorage

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

func NewStorage

func NewStorage(dsn string, dialect DialectExecutor) *SimpleStorage

func (SimpleStorage) DSN

func (s SimpleStorage) DSN() string

func (SimpleStorage) DialectExecutor

func (s SimpleStorage) DialectExecutor() DialectExecutor

type Storage

type Storage interface {
	DSN() string
	DialectExecutor() DialectExecutor
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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