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: 6

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