Documentation
¶
Index ¶
- Constants
- func InitMySQLWithConn(sqlDB *sql.DB, debug bool) *gorm.DB
- func InitMySQLWithDSN(dsn string, debug bool) *gorm.DB
- type BackOff
- type ConstantBackOff
- type DoneStore
- type ExponentialBackOff
- type LinearBackOff
- type LockCounter
- type LockStore
- type MySQCounterLock
- func (l *MySQCounterLock) Acquire(lockName string, wait time.Duration) error
- func (l *MySQCounterLock) Init(lockNameList []string)
- func (l *MySQCounterLock) Refresh(lockName string) error
- func (l *MySQCounterLock) Release(lockName string) error
- func (l *MySQCounterLock) SetClientID(clientID string)
- func (l *MySQCounterLock) SetMaxLockTime(d time.Duration)
- func (l *MySQCounterLock) StopRefresh(lockName string)
- func (l *MySQCounterLock) WithBackOff(b BackOff)
- type MySQLLockItf
- type MySQRowLock
Constants ¶
View Source
const ( LockStatusOpen = 0 LockStatusClosed = 1 )
Variables ¶
This section is empty.
Functions ¶
func InitMySQLWithConn ¶ added in v0.0.4
initialize *gorm.DB with an existing database connection
Types ¶
type ConstantBackOff ¶ added in v0.0.8
func NewConstantBackOff ¶ added in v0.0.8
func NewConstantBackOff(d time.Duration) *ConstantBackOff
func (*ConstantBackOff) NextBackOff ¶ added in v0.0.8
func (b *ConstantBackOff) NextBackOff() time.Duration
func (*ConstantBackOff) Reset ¶ added in v0.0.8
func (b *ConstantBackOff) Reset()
type DoneStore ¶ added in v0.0.8
func NewDoneStore ¶ added in v0.0.8
func NewDoneStore() *DoneStore
func (*DoneStore) CLoseDoneChan ¶ added in v0.0.8
func (*DoneStore) CreateDoneChan ¶ added in v0.0.8
func (*DoneStore) GetDoneChan ¶ added in v0.0.8
type ExponentialBackOff ¶ added in v0.0.8
func NewExponentialBackOff ¶ added in v0.0.8
func NewExponentialBackOff(initInterval time.Duration, multiplier float64) *ExponentialBackOff
func (*ExponentialBackOff) NextBackOff ¶ added in v0.0.8
func (l *ExponentialBackOff) NextBackOff() time.Duration
func (*ExponentialBackOff) Reset ¶ added in v0.0.8
func (l *ExponentialBackOff) Reset()
type LinearBackOff ¶ added in v0.0.8
func NewLinearBackOff ¶ added in v0.0.8
func NewLinearBackOff(initInterval time.Duration) *LinearBackOff
func (*LinearBackOff) NextBackOff ¶ added in v0.0.8
func (l *LinearBackOff) NextBackOff() time.Duration
func (*LinearBackOff) Reset ¶ added in v0.0.8
func (l *LinearBackOff) Reset()
type LockCounter ¶ added in v0.0.4
type LockCounter struct {
Name string `gorm:"column:name;size:100;index:uni_name,unique" json:"name"`
Owner string `gorm:"column:owner;size:100" json:"owner"`
Counter uint64 `gorm:"column:counter" json:"counter"`
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
ModifiedAt time.Time `gorm:"column:modified_at" json:"modifiedAt"`
ExpiredAt time.Time `gorm:"column:expired_at" json:"expiredAt"`
// other
ID int `gorm:"column:id" json:"id"`
}
func (LockCounter) TableName ¶ added in v0.0.4
func (LockCounter) TableName() string
type LockStore ¶
type MySQCounterLock ¶ added in v0.0.4
type MySQCounterLock struct {
MySQLClient *gorm.DB
ClientID string
MaxLockTime time.Duration
// contains filtered or unexported fields
}
func NewCounterLockWithConn ¶ added in v0.0.4
func NewCounterLockWithConn(db *sql.DB, debug bool) *MySQCounterLock
func NewCounterLockWithDSN ¶ added in v0.0.4
func NewCounterLockWithDSN(dsn string, debug bool) *MySQCounterLock
func (*MySQCounterLock) Acquire ¶ added in v0.0.4
func (l *MySQCounterLock) Acquire(lockName string, wait time.Duration) error
Lock :If the lock cannot be obtained, it will keep blocking wait: < 0 no wait
func (*MySQCounterLock) Init ¶ added in v0.0.4
func (l *MySQCounterLock) Init(lockNameList []string)
Init :Create tables
func (*MySQCounterLock) Refresh ¶ added in v0.0.8
func (l *MySQCounterLock) Refresh(lockName string) error
func (*MySQCounterLock) Release ¶ added in v0.0.4
func (l *MySQCounterLock) Release(lockName string) error
func (*MySQCounterLock) SetClientID ¶ added in v0.0.6
func (l *MySQCounterLock) SetClientID(clientID string)
func (*MySQCounterLock) SetMaxLockTime ¶ added in v0.0.8
func (l *MySQCounterLock) SetMaxLockTime(d time.Duration)
func (*MySQCounterLock) StopRefresh ¶ added in v0.0.8
func (l *MySQCounterLock) StopRefresh(lockName string)
func (*MySQCounterLock) WithBackOff ¶ added in v0.0.8
func (l *MySQCounterLock) WithBackOff(b BackOff)
type MySQLLockItf ¶ added in v0.0.4
type MySQRowLock ¶ added in v0.0.5
func NewRowLockWithConn ¶ added in v0.0.4
func NewRowLockWithConn(db *sql.DB, debug bool) *MySQRowLock
func NewRowLockWithDSN ¶ added in v0.0.4
func NewRowLockWithDSN(dsn string, debug bool) *MySQRowLock
func (*MySQRowLock) Acquire ¶ added in v0.0.5
func (l *MySQRowLock) Acquire(lockName string, wait time.Duration) error
Lock :If the lock cannot be obtained, it will keep blocking
func (*MySQRowLock) Init ¶ added in v0.0.5
func (l *MySQRowLock) Init(lockNameList []string)
Init :Create tables Create row record
func (*MySQRowLock) Release ¶ added in v0.0.5
func (l *MySQRowLock) Release(lockName string) error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.