File: routers_legacy_pathpattern.txt

package info (click to toggle)
golang-github-getkin-kin-openapi 0.124.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,288 kB
  • sloc: sh: 344; makefile: 4
file content (93 lines) | stat: -rw-r--r-- 2,122 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package pathpattern // import "github.com/getkin/kin-openapi/routers/legacy/pathpattern"

Package pathpattern implements path matching.

Examples of supported patterns:
  - "/"
  - "/abc""
  - "/abc/{variable}" (matches until next '/' or end-of-string)
  - "/abc/{variable*}" (matches everything, including "/abc" if "/abc" has root)
  - "/abc/{ variable | prefix_(.*}_suffix }" (matches regular expressions)

CONSTANTS

const (
	// SuffixKindConstant matches a constant string
	SuffixKindConstant = SuffixKind(iota)

	// SuffixKindRegExp matches a regular expression
	SuffixKindRegExp

	// SuffixKindVariable matches everything until '/'
	SuffixKindVariable

	// SuffixKindEverything matches everything (until end-of-string)
	SuffixKindEverything
)
    Note that order is important!


VARIABLES

var DefaultOptions = &Options{
	SupportWildcard: true,
}

FUNCTIONS

func EqualSuffix(a, b Suffix) bool
func PathFromHost(host string, specialDashes bool) string
    PathFromHost converts a host pattern to a path pattern.

    Examples:
      - PathFromHost("some-subdomain.domain.com", false) ->
        "com/./domain/./some-subdomain"
      - PathFromHost("some-subdomain.domain.com", true) ->
        "com/./domain/./subdomain/-/some"


TYPES

type Node struct {
	VariableNames []string
	Value         interface{}
	Suffixes      SuffixList
}

func (currentNode *Node) Add(path string, value interface{}, options *Options) error

func (currentNode *Node) CreateNode(path string, options *Options) (*Node, error)

func (currentNode *Node) Match(path string) (*Node, []string)

func (currentNode *Node) MustAdd(path string, value interface{}, options *Options)

func (currentNode *Node) String() string

type Options struct {
	SupportWildcard bool
	SupportRegExp   bool
}

type Suffix struct {
	Kind    SuffixKind
	Pattern string

	// Next node
	Node *Node
	// Has unexported fields.
}
    Suffix describes condition that

func (suffix Suffix) String() string

type SuffixKind int

type SuffixList []Suffix

func (list SuffixList) Len() int

func (list SuffixList) Less(i, j int) bool

func (list SuffixList) Swap(i, j int)