Versions in this module Expand all Collapse all v0 v0.1.0 Jun 2, 2025 Changes in this version + const DefaultLockName + type ConsulLocker struct + func NewConsulLocker(consulAddr string, opts ...Option) (*ConsulLocker, error) + func (l *ConsulLocker) Lock(ctx context.Context) error + func (l *ConsulLocker) Renew(ctx context.Context) error + func (l *ConsulLocker) Unlock(ctx context.Context) error + type EtcdLocker struct + func NewEtcdLocker(endpoints []string, opts ...Option) (*EtcdLocker, error) + func (l *EtcdLocker) Lock(ctx context.Context) error + func (l *EtcdLocker) Renew(ctx context.Context) error + func (l *EtcdLocker) Unlock(ctx context.Context) error + type GORMLocker struct + func NewGORMLocker(db *gorm.DB, opts ...Option) (*GORMLocker, error) + func (l *GORMLocker) Lock(ctx context.Context) error + func (l *GORMLocker) Renew(ctx context.Context) error + func (l *GORMLocker) Unlock(ctx context.Context) error + type Lock struct + CreatedAt time.Time + ExpiredAt time.Time + Name string + OwnerID string + UpdatedAt time.Time + type Locker interface + Lock func(ctx context.Context) error + Renew func(ctx context.Context) error + Unlock func(ctx context.Context) error + type MemcachedLocker struct + func NewMemcachedLocker(memcachedAddr string, opts ...Option) *MemcachedLocker + func (l *MemcachedLocker) Lock(ctx context.Context) error + func (l *MemcachedLocker) Renew(ctx context.Context) error + func (l *MemcachedLocker) Unlock(ctx context.Context) error + type MongoLocker struct + func NewMongoLocker(mongoURI string, dbName string, opts ...Option) (*MongoLocker, error) + func (l *MongoLocker) Lock(ctx context.Context) error + func (l *MongoLocker) Renew(ctx context.Context) error + func (l *MongoLocker) Unlock(ctx context.Context) error + type NoopLocker struct + func NewNoopLocker(opts ...Option) *NoopLocker + func (l *NoopLocker) Lock(ctx context.Context) error + func (l *NoopLocker) Renew(ctx context.Context) error + func (l *NoopLocker) Unlock(ctx context.Context) error + type Option func(o *Options) + func WithLockName(name string) Option + func WithLockTimeout(timeout time.Duration) Option + func WithLogger(logger logger.Logger) Option + func WithOwnerID(ownerID string) Option + type Options struct + func ApplyOptions(opts ...Option) *Options + func NewOptions() *Options + type RedisLocker struct + func NewRedisLocker(client *redis.Client, opts ...Option) *RedisLocker + func (l *RedisLocker) Lock(ctx context.Context) error + func (l *RedisLocker) Renew(ctx context.Context) error + func (l *RedisLocker) Unlock(ctx context.Context) error + type ZookeeperLocker struct + func NewZookeeperLocker(zkServers []string, opts ...Option) (*ZookeeperLocker, error) + func (l *ZookeeperLocker) Lock(ctx context.Context) error + func (l *ZookeeperLocker) Renew(ctx context.Context) error + func (l *ZookeeperLocker) Unlock(ctx context.Context) error