migraterice

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2019 License: MIT Imports: 7 Imported by: 1

README

Rice Source Driver for golang-migrate/migrate

Installation

go get github.com/atrox/go-migrate-rice

Example

import (
	rice "github.com/GeertJohan/go.rice"
	migraterice "github.com/atrox/go-migrate-rice"
	"github.com/golang-migrate/migrate/v4"
	"github.com/golang-migrate/migrate/v4/database/postgres"
)

// get rice box
migrationsBox := rice.MustFindBox("migrations")

// create source driver with specified rice box
sourceDriver, _ := migraterice.WithInstance(migrationsBox)

// create database driver
dbDriver, _ := postgres.WithInstance(openDatabase(), &postgres.Config{})

// create migration instance
m, _ := migrate.NewWithInstance("rice", sourceDriver, "postgres", dbDriver)

// migrate
m.Up()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithInstance

func WithInstance(box *rice.Box) (source.Driver, error)

Types

type RiceSourceDriver

type RiceSourceDriver struct {
	// contains filtered or unexported fields
}

func (*RiceSourceDriver) Close

func (r *RiceSourceDriver) Close() error

func (*RiceSourceDriver) First

func (r *RiceSourceDriver) First() (uint, error)

func (*RiceSourceDriver) Next

func (r *RiceSourceDriver) Next(version uint) (uint, error)

func (*RiceSourceDriver) Open

func (r *RiceSourceDriver) Open(url string) (source.Driver, error)

func (*RiceSourceDriver) Prev

func (r *RiceSourceDriver) Prev(version uint) (uint, error)

func (*RiceSourceDriver) ReadDown

func (r *RiceSourceDriver) ReadDown(version uint) (io.ReadCloser, string, error)

func (*RiceSourceDriver) ReadUp

func (r *RiceSourceDriver) ReadUp(version uint) (io.ReadCloser, string, error)

Jump to

Keyboard shortcuts

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