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.
Click to show internal directories.
Click to hide internal directories.