repository

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: MIT Imports: 8 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Source

type Source interface {
	Load() (map[int]string, error)
}

Source represents a migration repository.

The load method is responsible for loading a set of migrations. It should return a map with all the mirations. The key of the map should be the version of the migration. The value for each key should contain the SQL statements for the migration.

func FromEmbedded added in v1.1.0

func FromEmbedded(embedFS embed.FS, dir string) Source

FromEmbedded creates a new embedded file based repository

It expects an embed.FS object and a valid directory path to be passed on invocation. Migration files should be named: "0001_something_something.sql". The version number should be incremented for each migration.

func FromFiles

func FromFiles(dir string) Source

FromFiles creates a new file based repository

It expects a valid directory path to be passed on invocation. Migration files should be named: "0001_something_something.sql". The version number should be incremented for each migration.

func FromMemory

func FromMemory(migrations map[int]string) Source

FromMemory creates a new memory based repository.

The memory based repository is useful if you want to embed the migrations within your application. It expects a map of all migrations and versions to be passed on invocation.

Jump to

Keyboard shortcuts

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