router

package
v0.1.0-alpha.21 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package router implements GoBeyond's deterministic route-pattern matching.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mode

type Mode string
const (
	ModeStatic  Mode = "static"
	ModeDynamic Mode = "dynamic"
	ModeAPI     Mode = "api"
)

type Pattern

type Pattern struct {
	Source   string
	Segments []Segment
}

func Parse

func Parse(source string) (Pattern, error)

func (Pattern) Match

func (p Pattern) Match(path string) (map[string]string, bool)

type Route

type Route struct {
	ID      string `json:"id"`
	Pattern string `json:"pattern"`
	Mode    Mode   `json:"mode"`
	Reason  string `json:"reason,omitempty"`
	// contains filtered or unexported fields
}

type Segment

type Segment struct {
	Kind  SegmentKind
	Value string
}

type SegmentKind

type SegmentKind uint8
const (
	Literal SegmentKind = iota
	Dynamic
	CatchAll
	OptionalCatchAll
)

type Table

type Table struct {
	// contains filtered or unexported fields
}

func NewTable

func NewTable(routes []Route) (*Table, error)

func (*Table) Resolve

func (t *Table) Resolve(path string) (Route, map[string]string, bool)

func (*Table) Routes

func (t *Table) Routes() []Route

Jump to

Keyboard shortcuts

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