goldb

package
v0.0.0-...-1bfd785 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MigrationSQLDefault = map[string]string{
		"init": "CREATE TABLE IF NOT EXISTS migrations (uuid VARCHAR PRIMARY KEY) ;",
		"up":   "INSERT INTO migrations (uuid) VALUES ('%s') ;",
		"down": "DELETE FROM migrations WHERE uuid = '%s' ;",
	}

	MigrationSQL = map[string]map[string]string{
		"postgresql": MigrationSQLDefault,
		"postgres":   MigrationSQLDefault,
	}
)

Functions

func Migrate

func Migrate()

Types

type DataStore

type DataStore struct {
	ConnectionURL string
	DB            *sql.DB
	DBType        string
	MigrationsDir string
	MigrationType string
}

func (*DataStore) Connect

func (datastore *DataStore) Connect() (err error)

func (*DataStore) InitMigrationsTable

func (datastore *DataStore) InitMigrationsTable()

func (*DataStore) Migrate

func (datastore *DataStore) Migrate()

func (*DataStore) MigrateByType

func (datastore *DataStore) MigrateByType(migrationsDir string, migrationFile string, migrationType string)

func (*DataStore) Ping

func (datastore *DataStore) Ping() (err error)

func (*DataStore) RunSql

func (datastore *DataStore) RunSql(sql string) (err error)

Jump to

Keyboard shortcuts

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