dialect

package
v0.0.0-...-7acf401 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterDialect

func RegisterDialect(name string, dialect Dialect)

RegisterDialect register new dialect

Types

type Dialect

type Dialect interface {
	// Name get dialect's name
	Name() string

	// SetDB set db for dialect
	SetDB(db db.Store)

	// DB gets dialect db
	DB() db.Store

	// HasTable check has table or not
	HasTable(tableName string) bool

	// CurrentDatabase return current database name
	CurrentDatabase() string

	// MigrationExists  checks if migration version exists in database table
	MigrationExists(version string, tableName string) (bool, error)

	// CreateMigrationTable creates migrations table in database
	CreateMigrationTable(tableName string) error

	// CountRecords retunrs number of rows in provided table
	CountRecords(tableName string) (int, error)

	// SaveMigration stores migration version and name in database
	SaveMigration(tableName string, version string, name string) error

	// RemoveMigration deletes migration version from database table
	RemoveMigration(tableName string, version string) error
}

Dialect defines set of methods needed by migrator to interact with different database engines

It contains behaviors that differ across SQL database

func New

func New(name string, db db.Store) Dialect

New creates dialect instance for given dialect name and db connection

Jump to

Keyboard shortcuts

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