driver package - github.com/db-journey/migrate/v2/driver - Go Packages (original) (raw)
Package driver holds the driver interface.
- func FileExtension(d Driver) string
- func FileTemplate(d Driver) []byte
- func Lock(d Driver) error
- func Register(driverName, migrationFileExtension string, migrationFileTemplate []byte, ...)
- func Unlock(d Driver) error
- type Driver
- type FactoryFunc
- type Lockable
This section is empty.
This section is empty.
FileExtension returns extension of migration file for given driver. Panics if you provide instance of unregistered driver.
func FileTemplate(d Driver) []byte
FileTemplate returns initial content of migration file for given driver. Panics if you provide instance of unregistered driver.
Lock calls Lock method if driver implements Lockable
func Register(driverName, migrationFileExtension string, migrationFileTemplate []byte, f FactoryFunc)
Register 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. filenameExtension returns the extension of the migration files. migrationFileTemplate is a content that should be written into newly-created migration file (can be nil).
Unlock calls Unlock method if driver implements Lockable
Driver is the interface type that needs to implemented by all drivers.
New returns Driver and calls Initialize on it.
FactoryFunc produces driver instances
type Lockable interface { Lock() error Unlock() error }
Lockable represents driver that supports database locking. Implement if possible to make it safe to run migrations concurrently. NOTE: Probably better to move into Driver interface to make sure it's not dismissed when locking is possible to implement.