Documentation
¶
Index ¶
- func AnyValueToString(v slog.Value) string
- func AppendAttrsToGroup(groups []string, actualAttrs []slog.Attr, newAttrs ...slog.Attr) []slog.Attr
- func AppendRecordAttrsToAttrs(attrs []slog.Attr, groups []string, record *slog.Record) []slog.Attr
- func AttrToValue(attr slog.Attr) (string, any)
- func AttrsToMap(attrs ...slog.Attr) map[string]any
- func AttrsToString(attrs ...slog.Attr) map[string]string
- func Contains[T comparable](collection []T, element T) bool
- func ContextExtractor(ctx context.Context, fns []func(ctx context.Context) []slog.Attr) []slog.Attr
- func ExtractError(attrs []slog.Attr, errorKeys ...string) ([]slog.Attr, error)
- func ExtractFromContext(keys ...any) func(ctx context.Context) []slog.Attr
- func FilterMap[T any, R any](collection []T, callback func(item T, index int) (R, bool)) []R
- func FindAttrByGroupAndKey(attrs []slog.Attr, groups []string, key string) (slog.Attr, bool)
- func FindAttrByKey(attrs []slog.Attr, key string) (slog.Attr, bool)
- func FindAttribute(attrs []slog.Attr, groups []string, key string) (slog.Attr, bool)
- func FormatError(err error) map[string]any
- func FormatErrorKey(values map[string]any, errorKeys ...string) map[string]any
- func FormatRequest(req *http.Request, ignoreHeaders bool) map[string]any
- func Map[T any, R any](collection []T, iteratee func(item T, index int) R) []R
- func MapEntries[K1 comparable, V1 any, K2 comparable, V2 any](in map[K1]V1, iteratee func(key K1, value V1) (K2, V2)) map[K2]V2
- func MapToSlice[K comparable, V any, R any](in map[K]V, iteratee func(key K, value V) R) []R
- func RemoveEmptyAttrs(attrs []slog.Attr) []slog.Attr
- func ReplaceAttrs(fn ReplaceAttrFn, groups []string, attrs ...slog.Attr) []slog.Attr
- func ReplaceError(attrs []slog.Attr, errorKeys ...string) []slog.Attr
- func Source(sourceKey string, r *slog.Record) slog.Attr
- func StringSource(sourceKey string, r *slog.Record) slog.Attr
- func ToAnySlice[T any](collection []T) []any
- func UniqAttrs(attrs []slog.Attr) []slog.Attr
- func ValueToString(v slog.Value) string
- type ReplaceAttrFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnyValueToString ¶
func AppendAttrsToGroup ¶
func Contains ¶ added in v0.0.16
func Contains[T comparable](collection []T, element T) bool
Contains returns true if an element is present in a collection.
func ContextExtractor ¶
func ExtractFromContext ¶
func FilterMap ¶ added in v0.0.16
FilterMap returns a slice which obtained after both filtering and mapping using the given callback function. The callback function should return two values:
- the result of the mapping operation and
- whether the result element should be included or not.
func FindAttrByGroupAndKey ¶
func FindAttribute ¶
func FormatError ¶
func FormatErrorKey ¶
func Map ¶
Map manipulates a slice and transforms it to a slice of another type. Play: https://go.dev/play/p/OkPcYAhBo0D
func MapEntries ¶ added in v0.0.16
func MapEntries[K1 comparable, V1 any, K2 comparable, V2 any](in map[K1]V1, iteratee func(key K1, value V1) (K2, V2)) map[K2]V2
MapEntries manipulates a map entries and transforms it to a map of another type. Play: https://go.dev/play/p/VuvNQzxKimT
func MapToSlice ¶ added in v0.0.16
func MapToSlice[K comparable, V any, R any](in map[K]V, iteratee func(key K, value V) R) []R
MapToSlice transforms a map into a slice based on specific iteratee Play: https://go.dev/play/p/ZuiCZpDt6LD
func ReplaceAttrs ¶
func ToAnySlice ¶ added in v0.0.16
ToAnySlice returns a slice with all elements mapped to `any` type
func ValueToString ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.