util

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 9 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsContextLive added in v0.4.0

func IsContextLive(ctx context.Context) bool

IsContextLive reports whether ctx has neither been canceled nor reached its deadline.

func IsNeoTimeoutError

func IsNeoTimeoutError(err error) bool

IsNeoTimeoutError recognizes Neo4j transaction-timeout codes or their textual form. The caller must supply a non-nil error.

func IsPostgresTimeoutError added in v0.7.1

func IsPostgresTimeoutError(err error) bool

IsPostgresTimeoutError recognizes a wrapped PostgreSQL cancellation error whose message identifies a statement timeout.

func SLogError added in v0.4.0

func SLogError(msg string, err error, args ...any)

SLogError logs msg with the text of a non-nil error and the supplied structured fields.

func SLogMeasureFunction added in v0.4.0

func SLogMeasureFunction(functionName string, args ...any) func(args ...any)

SLogMeasureFunction logs entry and returns a completion logger sharing the measurement ID and initial fields.

func SLogSampleRepeated added in v0.4.0

func SLogSampleRepeated(functionName string, args ...any) func(args ...any)

SLogSampleRepeated returns a sampler that logs elapsed and average milliseconds between calls. Calls to the returned sampler must be serialized; its call arguments supply the log fields.

Types

type ErrorCollector

type ErrorCollector interface {
	// Add appends an error to the shared collection; nil errors are ignored by Combined.
	Add(err error)
	// Combined returns a joined snapshot of accumulated errors, or nil when none are non-nil.
	Combined() error
}

ErrorCollector serializes error collection and joins the errors accumulated so far.

func NewErrorCollector

func NewErrorCollector() ErrorCollector

NewErrorCollector creates an empty collector safe for concurrent use.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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