Documentation
¶
Index ¶
- func IsContextLive(ctx context.Context) bool
- func IsNeoTimeoutError(err error) bool
- func IsPostgresTimeoutError(err error) bool
- func SLogError(msg string, err error, args ...any)
- func SLogMeasureFunction(functionName string, args ...any) func(args ...any)
- func SLogSampleRepeated(functionName string, args ...any) func(args ...any)
- type ErrorCollector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsContextLive ¶ added in v0.4.0
IsContextLive reports whether ctx has neither been canceled nor reached its deadline.
func IsNeoTimeoutError ¶
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
IsPostgresTimeoutError recognizes a wrapped PostgreSQL cancellation error whose message identifies a statement timeout.
func SLogError ¶ added in v0.4.0
SLogError logs msg with the text of a non-nil error and the supplied structured fields.
func SLogMeasureFunction ¶ added in v0.4.0
SLogMeasureFunction logs entry and returns a completion logger sharing the measurement ID and initial fields.
func SLogSampleRepeated ¶ added in v0.4.0
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.