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 IsLockable(x interface{}) bool
- 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 DefaultLogger
- type Driver
- type Lockable
- type Locker
- type Logger
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 IsLockable ¶
func IsLockable(x interface{}) bool
IsLockable returns whether the given instance satisfies drivers.Lockable or not.
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 DefaultLogger ¶
type DefaultLogger struct { }
func (DefaultLogger) Printf ¶
func (DefaultLogger) Printf(format string, v ...interface{})
func (DefaultLogger) Println ¶
func (DefaultLogger) Println(v ...interface{})
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 Apply(migration *models.Migration, saveVersion bool) error AppliedMigrations() ([]*models.Migration, error) SetConfig(key string, value interface{}) error }
type Locker ¶
type Locker interface { // Lock 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. Lock(ctx context.Context) error Unlock() error }
Click to show internal directories.
Click to hide internal directories.