common

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

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(wait bool) error
}

type Debuggable

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

type Initializable

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

Initializable is implemented by services that require initialization. Init is called on first startup and on every restart, making it the appropriate place to load dynamic configuration that may change between runs.

type Liveness added in v0.3.0

type Liveness interface {
	Alive() error
}

type Message added in v0.2.16

type Message interface {
	Kind() string
}

type MessageHandler added in v0.2.16

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

type MessageSender added in v0.2.16

type MessageSender interface {
	SendMessage(ctx context.Context, from Named, message 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 {
	HandleRawMessage(ctx context.Context, kind string, payload any) error
}

type RawMessageSender added in v0.2.16

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

type Readiness added in v0.3.0

type Readiness interface {
	Ready() error
}

type Service

type Service interface {
	Named
	Dependencies() []Service
}

type Unique

type Unique interface {
	Key() string
}

type Weighted

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

Jump to

Keyboard shortcuts

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