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 ¶ added in v0.1.4
func GetDatabase() *Database
func NewDatabase ¶
func (*Database) RevertMigrations ¶ added in v0.1.3
func (*Database) RunMigrations ¶ added in v0.1.3
type SQLMigration ¶ added in v0.1.3
type SQLMigration struct {
// contains filtered or unexported fields
}
func NewSQLMigration ¶ added in v0.1.3
func NewSQLMigration(name string, upQuery string, downQuery string) SQLMigration
type SQLite ¶ added in v0.1.3
SQLite struct definition
func (*SQLite) AddMigration ¶ added in v0.1.3
func (s *SQLite) AddMigration(migration ...SQLMigration)
AddMigration adds SQLMigration to migrations, can pass array of migrations
func (*SQLite) Migrations ¶ added in v0.1.3
func (s *SQLite) Migrations() []SQLMigration
Migrations return migrations array
func (*SQLite) RevertMigrations ¶ added in v0.1.3
RevertMigrations revert all migrations in reverse order, from the last one to first
func (*SQLite) RunMigrations ¶ added in v0.1.3
RunMigrations run migrations - from first one to last
Click to show internal directories.
Click to hide internal directories.