Documentation ¶
Index ¶
- Constants
- func ExtractVersion(filename string) (version int64, err error)
- func HashFile(_fs fs.FS, filename string) (int64, error)
- func Migrate(ds DataSource, outOfOrder bool) error
- func SortDirectoryEntries(entries []fs.DirEntry) (status error)
- func ValidateConfig(cfg *Config) error
- type Config
- type DataSource
- type Migration
- type MigrationError
- type MigrationInfo
- type Migrator
Constants ¶
View Source
const DefaultTableName = "dsync_migration_info"
Variables ¶
This section is empty.
Functions ¶
func ExtractVersion ¶ added in v1.3.0
ExtractVersion Extract version from a migration changeset file
func Migrate ¶ added in v1.3.2
func Migrate(ds DataSource, outOfOrder bool) error
Migrate Perform a quick migration
func SortDirectoryEntries ¶ added in v1.3.0
SortDirectoryEntries Sorts the slice in place using the library's naming scheme.
NOTE: This function should not be treated as a validation function.
func ValidateConfig ¶
Types ¶
type Config ¶
func (*Config) TableNameOrDefault ¶
type DataSource ¶
type DataSource interface { // GetMigrationInfo Returns table name and other information GetMigrationInfo() (*MigrationInfo, error) // GetChangeSetFileSystem returns the source file system where migration changeset files are stored GetChangeSetFileSystem() (fs.FS, error) // GetPath Returns the base path within the file system where to GetPath() string // BeginTransaction Start transaction BeginTransaction() error // SetTransactionSuccessful notify the data source whether to commit or rollback when EndTransaction is called SetTransactionSuccessful(s bool) // ApplyMigration Applies the given migration ApplyMigration(migration *Migration) error // EndTransaction Commit or rollback the active transaction EndTransaction() // Handle Return the underlying database handle Handle() *sql.DB }
type Migration ¶
type Migration struct { Id uint32 Name string File string Version int64 CreatedAt time.Time Checksum int64 Success bool }
func ParseMigration ¶
ParseMigration Parse migration information from file name
type MigrationError ¶
func (MigrationError) Error ¶
func (e MigrationError) Error() string
type MigrationInfo ¶
Click to show internal directories.
Click to hide internal directories.