path

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WithParamGetter  = contextx.With[tCtxValueGetter, ValueGetter]
	CarryParamGetter = contextx.Carry[tCtxValueGetter, ValueGetter]
)

Functions

func CleanPath

func CleanPath(p string) string

func Normalize

func Normalize(p string) string

func Prefix

func Prefix(segments Segments) string

func ResolveFromTag

func ResolveFromTag(t reflect.Type) (string, string)

func SplitPath

func SplitPath(p string) []string

Types

type Encoder

type Encoder interface {
	Encode(Values) string
}

type Matcher

type Matcher interface {
	MatchTo(m ValuesModifier, uri string) (string, bool)
}

func NewMatcher

func NewMatcher(ss Segments, prefix string) Matcher

type NamedSegment

type NamedSegment interface {
	Segment
	ParamName() string
	Multiple() bool
}

type Node

type Node interface {
	Method() string
	PathSegments() Segments
}

type OrderedMap

type OrderedMap[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func (*OrderedMap[K, V]) Add

func (m *OrderedMap[K, V]) Add(k K, v V)

func (*OrderedMap[K, V]) Get

func (m *OrderedMap[K, V]) Get(k K) (V, bool)

func (*OrderedMap[K, V]) Keys

func (m *OrderedMap[K, V]) Keys() iter.Seq[K]

func (*OrderedMap[K, V]) Len

func (m *OrderedMap[K, V]) Len() int

func (*OrderedMap[K, V]) Values

func (m *OrderedMap[K, V]) Values() iter.Seq[V]

type Segment

type Segment interface {
	PathString() string
}

func NewSegment

func NewSegment(part string) Segment

type Segments

type Segments []Segment

func ParseSegments

func ParseSegments(p string) Segments

func (Segments) Chunk

func (ss Segments) Chunk() iter.Seq[Segments]

func (Segments) Encode

func (ss Segments) Encode(vs Values) string

func (Segments) MatchTo

func (ss Segments) MatchTo(vm ValuesModifier, res string) (string, bool)

func (Segments) PathString

func (ss Segments) PathString() string

func (Segments) PathValues

func (ss Segments) PathValues(resource string) (Values, error)

type Tree

type Tree[N Node] struct {
	// contains filtered or unexported fields
}

func (*Tree[N]) Add

func (t *Tree[N]) Add(n N)

func (*Tree) PathSegments

func (g *Tree) PathSegments() Segments

func (*Tree) PrintTo

func (g *Tree) PrintTo(w io.Writer, level int)

func (*Tree) Route

func (g *Tree) Route() iter.Seq[N]

func (*Tree[N]) String

func (t *Tree[N]) String() string

type ValueGetter

type ValueGetter interface {
	PathValue(k string) string
}

func ParamGetterFrom

func ParamGetterFrom(ctx context.Context) ValueGetter

type Values

type Values map[string]string

func (Values) PathValue

func (vs Values) PathValue(k string) string

func (Values) SetPathValue

func (vs Values) SetPathValue(key, value string)

type ValuesDescriber

type ValuesDescriber interface {
	PathValues(string) (Values, error)
}

type ValuesModifier

type ValuesModifier interface {
	SetPathValue(key, val string)
}

Jump to

Keyboard shortcuts

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