migration

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

README

Migration

Commonly used migration tools

Usage
package main

import (
	"context"
	"embed"

	"github.com/infiniteloopcloud/migration"
)

//go:embed files
var Files embed.FS

func main() {
	ctx := context.Background()

	// Library usage
	migration.Get(ctx, "database connection string", Files)

	// Executable usage
	migration.MigrationTool("database connection string", false, Files)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromEmbeds

func FromEmbeds(opts Opts, embeds ...embed.FS) (afero.Fs, error)

func Get

func Get(_ context.Context, conn string, opts Opts, embeds ...embed.FS) (*migrate.Migrate, error)

Get will return the migration prepared for the certain files embedded into the binary

func MigrationTool

func MigrationTool(conn string, down bool, opts Opts, embeds ...embed.FS)

Types

type Opts

type Opts struct {
	Path string
}

Jump to

Keyboard shortcuts

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