postgres

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStaleFencingToken = errors.New("fencing/postgres: stale fencing token")

ErrStaleFencingToken is returned when a mutation carries a stale token.

Functions

This section is empty.

Types

type Resource

type Resource struct {
	DB    *sql.DB
	Table string
	Name  string
}

Resource is a fenced row helper. Table schema (caller migrates):

CREATE TABLE IF NOT EXISTS shiftlock_fenced (
  name TEXT PRIMARY KEY,
  fencing_token BIGINT NOT NULL DEFAULT 0,
  value TEXT NOT NULL DEFAULT ''
);

func (*Resource) Read

func (r *Resource) Read() (string, shiftlock.FencingToken, error)

Read returns value and token.

func (*Resource) Write

func (r *Resource) Write(token shiftlock.FencingToken, value string) error

Write updates value only if token >= stored fencing token (monotonic accept).

Jump to

Keyboard shortcuts

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