common

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 5 Imported by: ? 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

Index

Constants

View Source
const (
	ContextKeyAPIRequestInfo  = "_api_request_info"
	ContextKeyAPIResponseInfo = "_api_response_info"
	ContextKeyAPIError        = "_api_error"

	ContextKeyCredential = "_credential"
	ContextKeySession    = "_session"
	ContextKeyNamespace  = "_namespace"
	ContextKeyDB         = "_db"
	ContextKeyTX         = "_tx"
	ContextKeyLogger     = "_logger"
	ContextKeyTrace      = "_trace"
	ContextKeyConfig     = "_config"
)
View Source
const (
	RedactMask = "REDACTED XXXX"
)
View Source
const (
	TimeFormat = "2006-01-02 15:04:05.00"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Daemon

type Daemon interface {
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
}

Daemon may be started and stopped repeatedly on one instance. Stop refuses new work, cancels and awaits the rest (an earlier Stop's leftovers included) until ctx ends, then forces what it can and returns an error wrapping ctx's; it returns only after intake has stopped, and leftovers must not reach a later Start.

type Debuggable

type Debuggable interface {
	Info(w io.Writer, debug bool)
}

type Initializable

type Initializable interface {
	Init(ctx context.Context) error
}

Init runs on first startup and every restart: load dynamic config here.

type Liveness added in v0.3.0

type Liveness interface {
	Alive(ctx context.Context) error
}

Probes honour the caller's ctx deadline; an implementation may only tighten it.

type Message added in v0.2.16

type Message interface {
	Kind() string
}

type MessageHandler added in v0.2.16

type MessageHandler interface {
	Named
	HandleMessage(ctx context.Context, msg Message) error
}

MessageHandler's name is its subscription; it need not be a Service.

type MessageSender added in v0.2.16

type MessageSender interface {
	Service
	SendMessage(ctx context.Context, from Named, msg Message)
}

type Named

type Named interface {
	Name() string
}

type Pair

type Pair[K comparable, V any] interface {
	SetKey(key K)
	SetValue(value V)
	GetKey() K
	GetValue() V
	String() string
}

func NewPair

func NewPair[K comparable, V any](key K, value V) Pair[K, V]

func ParsePair

func ParsePair(s string) (Pair[string, string], bool)

type Pairs

type Pairs []Pair[string, string]

func NewPairs

func NewPairs[T Pair[string, string]](src []T) Pairs

func ParsePairs

func ParsePairs(s string) (Pairs, bool)

func ParsePairsMap

func ParsePairsMap(m map[string]string) Pairs

func (Pairs) Map

func (p Pairs) Map() map[string]string

func (Pairs) String

func (p Pairs) String() string

type RawMessageHandler added in v0.2.16

type RawMessageHandler interface {
	Named
	HandleRawMessage(ctx context.Context, kind string, payload any) error
}

RawMessageHandler receives every message, typed or raw.

type RawMessageSender added in v0.2.16

type RawMessageSender interface {
	Service
	SendRawMessage(ctx context.Context, from Named, kind string, payload any)
}

type Readiness added in v0.3.0

type Readiness interface {
	Ready(ctx context.Context) error
}

type Service

type Service interface {
	Named
	// Dependencies are initialized and started first; nil entries are skipped.
	Dependencies() []Service
}

type Unique

type Unique interface {
	Key() string
}

type Weighted

type Weighted interface {
	Priority() int
	SetPriority(priority int)
}

Jump to

Keyboard shortcuts

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