utils

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseAndLog

func CloseAndLog(ctx context.Context, c Closer, msg string, keysAndValues ...any)

CloseAndLog is a utility function that closes a resource and logs any error that occurs. It should be used for defers to ensure that the resource is closed properly and any errors are logged.

func CloseIgnoreAndLog

func CloseIgnoreAndLog[I any](ctx context.Context, c CloserIgnore[I])

CloseIgnoreAndLog is a utility function that closes a resource and logs any error that occurs, and ignores the result. It should be used for defers to ensure that the resource is closed properly and any errors are logged.

func MergeMaps

func MergeMaps[K comparable, V any](base, override map[K]V) map[K]V

MergeMaps merges two maps, with the values from the second map overriding the values from the first map.

func RemoveAndLog added in v0.2.6

func RemoveAndLog(ctx context.Context, path string)

Types

type Closer

type Closer interface {
	Close() error
}

type CloserIgnore

type CloserIgnore[I any] interface {
	Close() (I, error)
}

Jump to

Keyboard shortcuts

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