backends

package
v0.0.0-...-192d3ef Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendConfig

type BackendConfig struct {
	DatabaseUrl     *url.URL
	DatabaseUser    string
	DatabasePass    string
	MigrationsTable string
	Log             io.Writer
}

type Interface

type Interface interface {
	OpenDatabase() (*sql.DB, error)
	DatabaseExists() (bool, error)
	CreateDatabase() error
	DropDatabase() error
	DumpSchema(db *sql.DB) ([]byte, error)
	CreateMigrationsTable(db *sql.DB) error
	SelectMigrations(db *sql.DB, id int) (map[string]bool, error)
	InsertMigration(tx Transaction, version string) error
	DeleteMigration(tx Transaction, version string) error
	Ping() error
}

type Transaction

type Transaction interface {
	Exec(query string, args ...interface{}) (sql.Result, error)
	Query(query string, args ...interface{}) (*sql.Rows, error)
	QueryRow(query string, args ...interface{}) *sql.Row
}

Transaction to abstract tx from sql and sqlx

Jump to

Keyboard shortcuts

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