db

package
v0.0.0-...-2ebb5e3 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const CreateMigrationTable string = `
	CREATE TABLE IF NOT EXISTS migration (
		name TEXT NOT NULL PRIMARY KEY,
		created_at INTEGER NOT NULL
	);
`
View Source
const DeleteMigrationEntry string = `
	DELETE FROM migration WHERE name = ?
`
View Source
const FindMigrationEntry string = `
	SELECT name FROM migration WHERE name = ?
`
View Source
const NewMigrationEntry string = `
	INSERT INTO migration (name, created_at) VALUES (?, ?)
`

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

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

func GetDatabase

func GetDatabase() *Database

func NewDatabase

func NewDatabase(config *config.Database) *Database

func (*Database) GetLevelDB

func (db *Database) GetLevelDB(name string) *leveldb.DB

func (*Database) GetSQLite

func (db *Database) GetSQLite(name string) *SQLite

func (*Database) RevertMigrations

func (db *Database) RevertMigrations() error

func (*Database) RunMigrations

func (db *Database) RunMigrations() error

type SQLMigration

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

func NewSQLMigration

func NewSQLMigration(name string, upQuery string, downQuery string) SQLMigration

type SQLite

type SQLite struct {
	Db *sql.DB
	// contains filtered or unexported fields
}

func (*SQLite) AddMigration

func (s *SQLite) AddMigration(migration ...SQLMigration)

func (*SQLite) Migrations

func (s *SQLite) Migrations() []SQLMigration

func (*SQLite) RevertMigrations

func (s *SQLite) RevertMigrations() error

func (*SQLite) RunMigrations

func (s *SQLite) RunMigrations() error

Jump to

Keyboard shortcuts

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