locker

package
v0.1.152 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOCKER_INMEMORY = "inmemory"
	LOCKER_POSTGRES = "postgres"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type InMemoryLocker

type InMemoryLocker struct {
	// contains filtered or unexported fields
}

func NewInMemoryLocker

func NewInMemoryLocker() *InMemoryLocker

func (*InMemoryLocker) AcquireLock

func (m *InMemoryLocker) AcquireLock(ctx context.Context, key string) (Lock, error)

type Lock

type Lock interface {
	ReleaseLock(ctx context.Context) error
}

type Locker

type Locker interface {
	AcquireLock(ctx context.Context, key string) (Lock, error)
}

type LockerOption added in v0.1.152

type LockerOption func(*PostgresLocker)

func WithConnMaxIdleTime added in v0.1.152

func WithConnMaxIdleTime(d time.Duration) LockerOption

func WithConnMaxLifetime added in v0.1.152

func WithConnMaxLifetime(d time.Duration) LockerOption

func WithMaxIdleConns added in v0.1.152

func WithMaxIdleConns(n int) LockerOption

func WithMaxOpenConns added in v0.1.152

func WithMaxOpenConns(n int) LockerOption

type PostgresLocker

type PostgresLocker struct {
	// contains filtered or unexported fields
}

func NewPostgresLocker

func NewPostgresLocker(dsn string, opts ...LockerOption) (*PostgresLocker, error)

func (*PostgresLocker) AcquireLock

func (p *PostgresLocker) AcquireLock(ctx context.Context, key string) (Lock, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL