migrate: github.com/gemnasium/migrate/driver Index | Files | Directories

package driver

import "github.com/gemnasium/migrate/driver"

Package driver holds the driver interface.


Package Files

driver.go registry.go

func Drivers Uses

func Drivers() []string

Drivers returns a sorted list of the names of the registered drivers.

func RegisterDriver Uses

func RegisterDriver(name string, driver Driver)

Registers a driver so it can be created from its name. Drivers should call this from an init() function so that they registers themselves on import.

type Driver Uses

type Driver interface {

    // Initialize is the first function to be called.
    // Check the url string and open and verify any connection
    // that has to be made.
    Initialize(url string) error

    // Close is the last function to be called.
    // Close any open connection here.
    Close() error

    // FilenameExtension returns the extension of the migration files.
    // The returned string must not begin with a dot.
    FilenameExtension() string

    // Migrate is the heart of the driver.
    // It will receive a file which the driver should apply
    // to its backend or whatever. The migration function should use
    // the pipe channel to return any errors or other useful information.
    Migrate(file file.File, pipe chan interface{})

    // Version returns the current migration version.
    Version() (file.Version, error)

    // Versions returns the list of applied migrations.
    Versions() (file.Versions, error)

Driver is the interface type that needs to implemented by all drivers.

func GetDriver Uses

func GetDriver(name string) Driver

Retrieves a registered driver by name.

func New Uses

func New(url string) (Driver, error)

New returns Driver and calls Initialize on it.


bashPackage bash implements the Driver interface.
cassandraPackage cassandra implements the Driver interface.
cratePackage crate implements a driver for the Crate.io database
mysqlPackage mysql implements the Driver interface.
postgresPackage postgres implements the Driver interface.
sqlite3Package sqlite3 implements the Driver interface.

Package driver imports 5 packages (graph) and is imported by 45 packages. Updated 2017-11-04. Refresh now. Tools for package owners.