dbal

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package dbal Code generated by go-bindata. (@generated) DO NOT EDIT. sources: stub/a/1.sql stub/a/3.sql stub/b/2.sql stub/c/2.sql stub/c/4.sql stub/d/1_test.sql stub/d/2_test.sql stub/d/3_test.sql stub/d/4_test.sql

Index

Constants

View Source
const (
	// DriverMySQL is the mysql driver name.
	DriverMySQL = "mysql"

	// DriverPostgreSQL is the postgres driver name.
	DriverPostgreSQL = "postgres"

	// DriverCockroachDB is the cockroach driver name.
	DriverCockroachDB = "cockroach"

	// UnknownDriver is the driver name if the driver is unknown.
	UnknownDriver = "unknown"
)
View Source
const (
	InMemoryDSN = "sqlite://:memory:?_fk=true"
)

Variables

View Source
var (

	// ErrNoResponsibleDriverFound is returned when no driver was found for the provided DSN.
	ErrNoResponsibleDriverFound = errors.New("dsn value requested an unknown driver")
	ErrSQLiteSupportMissing     = errors.New(`the DSN connection string looks like a SQLite connection, but SQLite support was not built into the binary. Please check if you have downloaded the correct binary or are using the correct Docker Image. Binary archives and Docker Images indicate SQLite support by appending the -sqlite suffix`)
)

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func Canonicalize

func Canonicalize(database string) string

Canonicalize returns constants DriverMySQL, DriverPostgreSQL, DriverCockroachDB, UnknownDriver, depending on `database`.

func Connect

func Connect(db string, logger *logrus.Logger, memf func() error, sqlf func(db *sqlx.DB) error) error

Connect is a wrapper for connecting to different SQL drivers.

func FindMatchingTestMigrations

func FindMatchingTestMigrations(folder string, migrations map[string]*PackrMigrationSource, assetNames []string, asset func(string) ([]byte, error)) map[string]*PackrMigrationSource

FindMatchingTestMigrations finds the matching test migrations from a migration map

func IsSQLite

func IsSQLite(dsn string) bool

IsSQLite returns true if the connection is a SQLite string.

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func MustCanonicalize

func MustCanonicalize(database string) string

MustCanonicalize returns constants DriverMySQL, DriverPostgreSQL, DriverCockroachDB or fatals.

func RegisterDriver

func RegisterDriver(d func() Driver)

RegisterDriver registers a driver

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type Driver

type Driver interface {
	// CanHandle returns true if the driver is capable of handling the given DSN or false otherwise.
	CanHandle(dsn string) bool

	// Ping returns nil if the driver has connectivity and is healthy or an error otherwise.
	Ping() error
}

Driver represents a driver

func GetDriverFor

func GetDriverFor(dsn string) (Driver, error)

GetDriverFor returns a driver for the given DSN or ErrNoResponsibleDriverFound if no driver was found.

type PackrMigrationSource

type PackrMigrationSource struct {
	*migrate.PackrMigrationSource
	// contains filtered or unexported fields
}

PackrMigrationSource is a wrapper around *migrate.PackrMigrationSource that allows to modify IDs.

func NewMustPackerMigrationSource

func NewMustPackerMigrationSource(l *logrus.Logger, folder []string, loader func(string) ([]byte, error), filters []string, omitExtension bool) *PackrMigrationSource

NewMustPackerMigrationSource create a new packr-based migration source or fatals.

func NewPackerMigrationSource

func NewPackerMigrationSource(l *logrus.Logger, sources []string, loader func(string) ([]byte, error), filters []string, omitExtension bool) (*PackrMigrationSource, error)

NewPackerMigrationSource create a new packr-based migration source or returns an error

func (PackrMigrationSource) FindMigrations

func (p PackrMigrationSource) FindMigrations() ([]*migrate.Migration, error)

FindMigrations finds migrations in this source.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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