Documentation ¶
Index ¶
- Constants
- Variables
- func WithInstance(instance *mongo.Client, config *Config) (database.Driver, error)
- type Config
- type Locking
- type Mongo
- func (m *Mongo) Close() error
- func (m *Mongo) Drop() error
- func (m *Mongo) ListAppliedVersions() ([]int, error)
- func (m *Mongo) Lock() error
- func (m *Mongo) Open(dsn string) (database.Driver, error)
- func (m *Mongo) Run(migration io.Reader) error
- func (m *Mongo) SetSourceDriver(sourceDrv source.Driver) error
- func (m *Mongo) SetVersion(version int, dirty bool, forced bool, knownDirection *source.Direction) (*source.Direction, error)
- func (m *Mongo) Unlock() error
- func (m *Mongo) Version() (version int, dirty bool, err error)
Constants ¶
View Source
const DefaultAdvisoryLockingFlag = true // the default value for the advisory locking feature flag. Default is true.
View Source
const DefaultLockTimeout = 15 // the default maximum time to wait for a lock to be released.
View Source
const DefaultLockTimeoutInterval = 10 // the default maximum intervals time for the locking timout.
View Source
const DefaultLockingCollection = "migrate_advisory_lock" // the collection to use for advisory locking by default.
View Source
const LockIndexName = "lock_unique_key" // the name of the index which adds unique constraint to the locking_key field.
Variables ¶
View Source
var ( ErrNoDatabaseName = fmt.Errorf("no database name") ErrNilConfig = fmt.Errorf("no config") ErrLockTimeoutConfigConflict = fmt.Errorf("both x-advisory-lock-timeout-interval and x-advisory-lock-timout-interval were specified") )
View Source
var DefaultMigrationsCollection = "schema_migrations"
Functions ¶
Types ¶
type Mongo ¶
type Mongo struct {
// contains filtered or unexported fields
}
func (*Mongo) ListAppliedVersions ¶
func (*Mongo) Lock ¶
Utilizes advisory locking on the config.LockingCollection collection This uses a unique index on the `locking_key` field.
func (*Mongo) SetSourceDriver ¶
This database driver does not currently support file sourcing.
func (*Mongo) SetVersion ¶
Click to show internal directories.
Click to hide internal directories.