Help us shape the future of Go! Take the 2026 Go Developer Survey

sql

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQLConfig

type MySQLConfig struct {
	Address  string `yaml:"address"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
	Database string `yaml:"database"`
	Options  string `yaml:"options,omitempty"`
}

type PostgresConfig

type PostgresConfig struct {
	Address  string `yaml:"address"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
	Database string `yaml:"database"`
	Options  string `yaml:"options,omitempty"`
}

type SQLBackend

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

func NewMySQLBackend

func NewMySQLBackend(cfg MySQLConfig) (*SQLBackend, error)

func NewPostgresBackend

func NewPostgresBackend(cfg PostgresConfig) (*SQLBackend, error)

func NewSQLiteBackend

func NewSQLiteBackend(cfg SQLiteConfig) (*SQLBackend, error)

func (*SQLBackend) Close

func (s *SQLBackend) Close() error

Calls all necessary finalization if necessary

func (*SQLBackend) GetLocks

func (s *SQLBackend) GetLocks(group string) (int, error)

Returns the current number of locks for the given group

func (*SQLBackend) GetStaleLocks

func (s *SQLBackend) GetStaleLocks(ts time.Duration) ([]types.Lock, error)

Return all locks older than x

func (*SQLBackend) HasLock

func (s *SQLBackend) HasLock(group, id string) (bool, error)

Check if a given id already has a lock for this group

func (*SQLBackend) Release

func (s *SQLBackend) Release(group string, id string) error

Release the lock currently held by the id. Does not fail when no lock is held.

func (*SQLBackend) Reserve

func (s *SQLBackend) Reserve(group string, id string) error

Reserve a lock for the given group. Returns true if the lock is successfully reserved, even if the lock is already held by the specific id

type SQLiteConfig

type SQLiteConfig struct {
	File string `yaml:"file"`
}

Jump to

Keyboard shortcuts

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