pathadaptor

package
v2.7.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package pathadaptor provides a path adaptor.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PathAdaptor

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

PathAdaptor is the path Adaptor.

func New

func New(spec *Spec) *PathAdaptor

New creates a pathAdaptor.

func (*PathAdaptor) Adapt

func (pa *PathAdaptor) Adapt(path string) string

Adapt adapts path.

type RegexpReplace

type RegexpReplace struct {
	Regexp  string `json:"regexp" jsonschema:"required,format=regexp"`
	Replace string `json:"replace"`
	// contains filtered or unexported fields
}

RegexpReplace use regexp-replace pair to rewrite path.

type Spec

type Spec struct {
	Replace       string         `json:"replace,omitempty"`
	AddPrefix     string         `json:"addPrefix,omitempty" jsonschema:"pattern=^/"`
	TrimPrefix    string         `json:"trimPrefix,omitempty" jsonschema:"pattern=^/"`
	RegexpReplace *RegexpReplace `json:"regexpReplace,omitempty"`
}

Spec describes rules for PathAdaptor.

Jump to

Keyboard shortcuts

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