entities

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DBsqlite3    = iota
	DBpostgresql = iota
)
View Source
const (
	MIGRATION_TYPE_UP   = "up"
	MIGRATION_TYPE_DOWN = "down"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileSystemRepo added in v0.0.2

type FileSystemRepo interface {
	MkAlldirIfnotExists(paths []string) error
	CreateFilesInDirectories(directoryList []string, fileNames []string) error
	GetMigrationFilesFromDirectory(directory string, database int) []string
	GetMigrationsFromFiles(string, []string, string) (*[]PGMigration, error)
}

type MigrationEntry added in v0.0.2

type MigrationEntry struct {
	Name    string
	MigType string
	Created time.Time
}

type MigratorConfig added in v0.0.2

type MigratorConfig struct {
	Database  int
	Extention string
	Migrator  MigratorService
}

type MigratorService added in v0.0.2

type MigratorService interface {
	// MigrateUp(0) will run all migrations
	// MigrateUp(2) will run next 2 migrations
	MigrateUp(int) error
	// MigrateDown(0) will run all down migrations
	// MigrateDown(2) will run next 2 migrations
	MigrateDown(int) error
	CleanMigrationTable() error
	GetMigrationEntries() (*[]MigrationEntry, error)
}

type PGMigration added in v0.0.2

type PGMigration struct {
	Name  string
	Query string
	Type  string
}

type PGRepo added in v0.0.2

type PGRepo interface {
	CreateMigrationTableIfNotExists() error
	GetLastAppliedMigrationFromDatabase() (*MigrationEntry, error)
	ApplyMigration(migration *PGMigration) error
	GetMigrationEntries() (*[]MigrationEntry, error)
	CleanMigrationTable() error
}

Jump to

Keyboard shortcuts

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