store

package
v0.6.123 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package store stands in for an infra package (pkg/backplane/infra/postgres, infra/valkey): a config section plus a deps.Provider built from it. The service embeds the section in its Config and passes it to New explicitly.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrScheme is returned for a DSN the store cannot open.
	ErrScheme = errors.New("store: only mem:// is supported")
	// ErrDown is what the probe reports while Config.Down is set.
	ErrDown = errors.New("store: down")
)

Errors.

Functions

func New

func New(cfg *Config) deps.Provider[*DB]

New is the provider of a store configured by cfg.

Types

type Config

type Config struct {
	// Connection string; never printed.
	DSN config.Secret `json:"dsn" schemapb:"default=mem://"`
	// Requests slower than this are logged; changed live from the console.
	SlowLog config.Live[time.Duration] `json:"slow_log" schemapb:"default=100ms"`
	// Makes the probe fail, as an outage would: a required store takes the
	// instance out of readiness, an optional one (ProbeOptional) disappears
	// from Get. Changed live from the console.
	Down config.Live[bool] `json:"down" schemapb:"default=false"`
}

Config of one store.

type DB

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

DB counts greetings per name.

func (*DB) Inc

func (db *DB) Inc(ctx context.Context, name string) uint64

Inc counts a greeting for name and returns the new count.

func (*DB) Total

func (db *DB) Total() uint64

Total greetings.

Jump to

Keyboard shortcuts

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