Documentation
¶
Overview ¶
Package sqllock implements the shared SQL lock algorithm for dialect modules.
Index ¶
- type Config
- type Store
- func (s *Store) Acquire(ctx context.Context, key, owner string, ttl time.Duration) (bool, error)
- func (s *Store) Migrate(ctx context.Context) error
- func (s *Store) MigrationSQL() string
- func (s *Store) Release(ctx context.Context, key, owner string) error
- func (s *Store) Renew(ctx context.Context, key, owner string, ttl time.Duration) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct{ Table, KeyColumn, OwnerColumn, ExpiryColumn string }
Config maps a dedicated lock table. Empty identifiers select defaults.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a dialect-specific SQL backend; the caller owns the database connection.
func (*Store) Acquire ¶
Acquire inserts a placeholder and conditionally takes an expired lock in one short transaction. No transaction or connection remains held during user work.
func (*Store) Migrate ¶
Migrate creates the configured table explicitly. It never changes existing rows.
func (*Store) MigrationSQL ¶
MigrationSQL returns idempotent DDL for the configured dedicated table.
Click to show internal directories.
Click to hide internal directories.