router

package
v0.16.3 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

CRC: crc-Router.md Spec: interfaces.md

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseURL

func ParseURL(urlPath string) (sessionID, path string)

ParseURL extracts session ID and path from a full URL path. Input: /SESSION-ID/some/path Returns: sessionID, path (e.g., "SESSION-ID", "/some/path")

Types

type Route

type Route struct {
	Path       string // URL path pattern (without session prefix)
	VariableID int64  // Associated presenter variable ID
}

Route maps a URL path to a presenter variable ID.

type Router

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

Router handles URL routing for a session.

func New

func New(sessionID string) *Router

New creates a new router for the given session.

func (*Router) BuildURL

func (r *Router) BuildURL(path string) string

BuildURL constructs the full URL for a presenter path. Returns /{sessionID}/{path} format.

func (*Router) GetRoutes

func (r *Router) GetRoutes() []Route

GetRoutes returns a copy of all registered routes.

func (*Router) GetSessionID

func (r *Router) GetSessionID() string

GetSessionID returns the session ID for this router.

func (*Router) IsRegisteredPath

func (r *Router) IsRegisteredPath(path string) bool

IsRegisteredPath checks if a path was explicitly registered.

func (*Router) Match

func (r *Router) Match(path string) bool

Match checks if a URL matches any registered pattern.

func (*Router) Register

func (r *Router) Register(path string, variableID int64)

Register associates a URL path with a presenter variable.

func (*Router) Resolve

func (r *Router) Resolve(path string) (int64, bool)

Resolve finds the presenter variable ID for a URL path. Returns the variable ID and true if found, 0 and false otherwise.

func (*Router) Unregister

func (r *Router) Unregister(path string) bool

Unregister removes a URL path mapping.

Jump to

Keyboard shortcuts

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