withsupport

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: BSD-3-Clause Imports: 1 Imported by: 8 modules, 7 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package withsupport provides support for Handler.WithAttr and Handler.WithGroup.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GroupOrAttrs

type GroupOrAttrs struct {
	Group string      // group name if non-empty
	Attrs []slog.Attr // attrs if non-empty
	Next  *GroupOrAttrs
}

GroupOrAttrs holds either a group name or a list of slog.Attrs.

func (*GroupOrAttrs) Apply

func (g *GroupOrAttrs) Apply(f func(groups []string, a slog.Attr)) []string

Apply calls f on each Attr in g. The first argument to f is the list of groups that precede the Attr. Apply returns the complete list of groups.

func (*GroupOrAttrs) Collect

func (g *GroupOrAttrs) Collect() []*GroupOrAttrs

Collect returns a slice of the GroupOrAttrs in reverse order.

func (*GroupOrAttrs) WithAttrs

func (g *GroupOrAttrs) WithAttrs(attrs []slog.Attr) *GroupOrAttrs

WithAttrs returns a GroupOrAttrs that includes the given attrs.

func (*GroupOrAttrs) WithGroup

func (g *GroupOrAttrs) WithGroup(name string) *GroupOrAttrs

WithGroup returns a GroupOrAttrs that includes the given group.

Jump to

Keyboard shortcuts

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