path

package
v0.12.5 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EqualLocation

func EqualLocation(a, b Location) bool

EqualLocation reports whether a and b encode the same path and query.

Types

type AnyModelAdapter added in v0.12.1

type AnyModelAdapter interface {
	EncodeAny(any) (Location, error, bool)
}

type Encoder added in v0.12.1

type Encoder interface {
	Encode() (Location, error)
}

type HookMatch

type HookMatch struct {
	Instance string
	Hook     uint64
	Track    uint64
}

type Location

type Location struct {
	// Segments holds the decoded path segments without leading or trailing
	// slashes.
	Segments []string
	// Query holds the decoded query parameters.
	Query url.Values
}

Location is a parsed or generated URL path plus query string.

func Encode added in v0.12.1

func Encode(m any) (Location, error)

func NewLocationFromEscapedURI

func NewLocationFromEscapedURI(s string) Location

NewLocationFromEscapedURI parses s into a Location.

func NewLocationFromURL

func NewLocationFromURL(u *url.URL) Location

NewLocationFromURL decodes u into a Location.

func (Location) Path

func (l Location) Path() string

Path returns the escaped path portion of l without the query string.

func (Location) String

func (l Location) String() string

String returns l encoded as `/<segments>?<query>`.

type Match

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

func (Match) Hook

func (m Match) Hook() (HookMatch, bool)

func (Match) Resource

func (m Match) Resource() (id string, ok bool)

func (Match) Sync

func (m Match) Sync() (instanceID string, ok bool)

func (Match) Undo

func (m Match) Undo() (UndoPath, bool)

type ModelAdapter added in v0.12.1

type ModelAdapter[M any] adapter

func GetModelAdapter added in v0.12.1

func GetModelAdapter[M any]() (ModelAdapter[M], error)

func (ModelAdapter[M]) Decode added in v0.12.1

func (ma ModelAdapter[M]) Decode(l Location) (*M, bool)

func (ModelAdapter[M]) Encode added in v0.12.1

func (ma ModelAdapter[M]) Encode(m *M) (Location, error)

type PathMaker

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

func NewPathMaker

func NewPathMaker(serverID string) PathMaker

func (PathMaker) Hook

func (pm PathMaker) Hook(instanceId string, hookId uint64, name string) string

func (PathMaker) ID

func (pm PathMaker) ID() string

func (PathMaker) Match

func (pm PathMaker) Match(r *http.Request) (Match, bool)

func (PathMaker) Prefix

func (pm PathMaker) Prefix() string

func (PathMaker) Resource

func (pm PathMaker) Resource(r *resources.Resource, name string) string

func (PathMaker) SessionCookie added in v0.12.1

func (pm PathMaker) SessionCookie() string

type UndoPath

type UndoPath struct {
	Instance string
	Location Location
}

Jump to

Keyboard shortcuts

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