locking

package
v8.7.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package locking provides functions for acquiring and releasing MySQL advisory locks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Acquire

func Acquire(tx *gorm.DB, lockKey string, opts ...Option) (release func() error, err error)

Acquire acquires a MySQL advisory lock. Returns a release function and an error.

It's the responsibility of the caller to release the lock by calling the release function.

Types

type Option

type Option func(*Options)

Option is a function that applies an option to an Options instance.

func WithRetry

func WithRetry(opts *backoff.Options) Option

WithRetry sets the retry options.

type Options

type Options struct {
	Retry *backoff.Options
}

Options represents the locking options.

Jump to

Keyboard shortcuts

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