Documentation ¶
Index ¶
- func BinarySchemaVersion(dialect string) int
- func MigrateStore(ctx context.Context, dialect string, url string) (bool, error)
- type Manager
- func (b *Manager) CurrentState(ctx context.Context) (*State, error)
- func (b *Manager) ExclusiveLock(ctx context.Context) error
- func (b *Manager) ExclusiveUnlock(ctx context.Context) error
- func (b *Manager) RollForward(ctx context.Context) error
- func (b *Manager) SharedLock(ctx context.Context) error
- func (b *Manager) SharedUnlock(ctx context.Context) error
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinarySchemaVersion ¶
BinarySchemaVersion provides the schema version that this binary supports for the provided dialect. If the binary doesn't support this dialect -1 is returned.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager provides a way to run operations and retrieve information regarding the underlying boundary database schema. Manager is not thread safe.
func NewManager ¶
NewManager creates a new schema manager. An error is returned if the provided dialect is unrecognized or if the passed in db is unreachable.
func (*Manager) CurrentState ¶
CurrentState provides the state of the boundary schema contained in the backing database.
func (*Manager) ExclusiveLock ¶
ExclusiveLock attempts to obtain an exclusive lock on the database. An error is returned if a lock was unable to be obtained.
func (*Manager) ExclusiveUnlock ¶
ExclusiveUnlock releases a shared lock on the database. If this fails for whatever reason an error is returned. Unlocking a lock that is not held is not an error.
func (*Manager) RollForward ¶
RollForward updates the database schema to match the latest version known by the boundary binary. An error is not returned if the database is already at the most recent version.
func (*Manager) SharedLock ¶
SharedLock attempts to obtain a shared lock on the database. This can fail if an exclusive lock is already held. If the lock can't be obtained an error is returned.
type State ¶
type State struct { // InitializationStarted indicates if the current database has been initialized previously. InitializationStarted bool // Dirty is set to true if the database failed in a previous migration/initialization. Dirty bool // DatabaseSchemaVersion is the schema version that is currently running in the database. DatabaseSchemaVersion int // BinarySchemaVersion is the schema version which this boundary binary supports. BinarySchemaVersion int }
State contains information regarding the current state of a boundary database's schema.