Documentation
¶
Index ¶
- Constants
- func ExtractCustomParams(conn string, params []string) (map[string]string, error)
- func GenerateAdvisoryLockID(databaseName, schemaName string) (string, error)
- func GetContext(timeoutInSeconds int) (context.Context, context.CancelFunc)
- func MakeLockKey(key string) (string, error)
- func NextWaitInterval(lastWaitInterval time.Duration, err error) time.Duration
- func RemoveParamsFromURL(conn string, params []string) (string, error)
- type AppError
- type Config
- type DatabaseError
- type Driver
- type Lockable
- type Locker
Constants ¶
View Source
const ( // MutexTableName is the name being used for the mutex table MutexTableName = "db_lock" // TTL is the interval after which a locked mutex will expire unless refreshed TTL = time.Second * 15 // RefreshInterval is the interval on which the mutex will be refreshed when locked RefreshInterval = TTL / 2 )
Variables ¶
This section is empty.
Functions ¶
func ExtractCustomParams ¶
func GenerateAdvisoryLockID ¶
func GetContext ¶
func GetContext(timeoutInSeconds int) (context.Context, context.CancelFunc)
func MakeLockKey ¶
MakeLockKey returns the prefixed key used to namespace mutex keys.
func NextWaitInterval ¶
NextWaitInterval determines how long to wait until the next lock retry.
Types ¶
type DatabaseError ¶
type DatabaseError struct {
OrigErr error
Driver string
Message string
Command string
Query []byte
}
func (*DatabaseError) Error ¶
func (de *DatabaseError) Error() string
type Driver ¶
type Driver interface {
Ping() error
// Close closes the underlying db connection. If the driver is created via Open() function
// this method will also going to call Close() on the sql.db instance.
Close() error
Lock() error
Unlock() error
Apply(migration *models.Migration, saveVersion bool) error
AppliedMigrations() ([]*models.Migration, error)
SetConfig(key string, value interface{}) error
}
type Locker ¶
type Locker interface {
sync.Locker
// LockWithContext locks m unless the context is canceled. If the mutex is already locked by any other
// instance, including the current one, the calling goroutine blocks until the mutex can be locked,
// or the context is canceled.
//
// The mutex is locked only if a nil error is returned.
LockWithContext(ctx context.Context) error
}
Click to show internal directories.
Click to hide internal directories.