Documentation
¶
Index ¶
Constants ¶
View Source
const PGQuery = ` INSERT INTO ` + lock.Table + `("` + lock.FieldID + `", "` + lock.FieldVersion + `", "` + lock.FieldOwner + `") VALUES($1, $2, $3) ON CONFLICT ("` + lock.FieldID + `") DO UPDATE SET "` + lock.FieldVersion + `" = $2, "` + lock.FieldOwner + `" = $3 WHERE ` + lock.Table + `."` + lock.FieldVersion + `" IS NULL OR ` + lock.Table + `."` + lock.FieldVersion + `" = $4`
View Source
const SQLiteQuery = ` INSERT INTO ` + lock.Table + ` ("` + lock.FieldID + `", "` + lock.FieldVersion + `", "` + lock.FieldOwner + `") VALUES( ?, ?, ? ) ON CONFLICT ("` + lock.FieldID + `") DO UPDATE SET "` + lock.FieldVersion + `" = ?, "` + lock.FieldOwner + `" = ? WHERE ` + lock.Table + `."` + lock.FieldVersion + `" IS NULL OR ` + lock.Table + `."` + lock.FieldVersion + `" = ?`
Variables ¶
View Source
var ( ErrInvalidOptions = errors.New("invalid options") ErrOpeningDatabase = errors.New("failed opening connection to database") ErrRunningMigrations = errors.New("failed running database migrations") ErrClosingDatabase = errors.New("failed closing connection to database") ErrNotAcquired = errors.New("lock not acquired") ErrNotReleased = errors.New("lock not released") ErrCreateTransaction = errors.New("cannot create transaction") ErrCommitTransaction = errors.New("cannot commit transaction") ErrSerializationError = errors.New("serialization error") ErrRefreshLease = errors.New("cannot refresh lease") ErrLockAlreadyReleased = errors.New("lock already released") )
View Source
var ( ErrInvalidOwner = errors.New("invalid owner") ErrInvalidDBType = errors.New("invalid database type") ErrInvalidDatabaseURL = errors.New("invalid database URL") ErrInvalidLeaseDuration = errors.New("invalid lease duration") ErrInvalidLeaseRefreshFrequency = errors.New("invalid lease refresh frequency") )
Functions ¶
This section is empty.
Types ¶
type DBLock ¶ added in v0.1.1
type DBLock struct {
// contains filtered or unexported fields
}
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
func (*Lock) IsReleased ¶
Click to show internal directories.
Click to hide internal directories.