Documentation
¶
Overview ¶
Package directiveparser implements a parser for the Zero's compiler directives.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Directive ¶
type DirectiveAPI ¶
type DirectiveAPI struct { Method string `parser:"'api' @Method?"` // HTTP method, empty for any method Host string `parser:"(@~'/')*"` // Host pattern, empty for any host Segments []Segment `parser:"@@+"` // Parsed path segments Labels []*Label `parser:"@@*"` }
DirectiveAPI represents a //zero:api directive
func (*DirectiveAPI) Path ¶
func (p *DirectiveAPI) Path() string
func (*DirectiveAPI) Pattern ¶
func (p *DirectiveAPI) Pattern() string
Pattern returns the http.ServeMux-compatible pattern.
func (*DirectiveAPI) String ¶
func (p *DirectiveAPI) String() string
func (*DirectiveAPI) Validate ¶
func (p *DirectiveAPI) Validate() error
func (*DirectiveAPI) Wildcard ¶
func (p *DirectiveAPI) Wildcard(name string) bool
type DirectiveConfig ¶
type DirectiveConfig struct {
Prefix string `parser:"'config' ('prefix' '=' @String)?"`
}
func (*DirectiveConfig) String ¶
func (d *DirectiveConfig) String() string
func (*DirectiveConfig) Validate ¶
func (d *DirectiveConfig) Validate() error
type DirectiveCron ¶ added in v0.12.0
type DirectiveCron struct {
Schedule string `parser:"'cron' @(Number ('h' | 'H' | 'm' | 'm' | 's' | 'S' | 'd' | 'D' | 'w' | 'W'))"`
}
func (*DirectiveCron) Duration ¶ added in v0.12.0
func (d *DirectiveCron) Duration() (time.Duration, error)
func (*DirectiveCron) String ¶ added in v0.12.0
func (d *DirectiveCron) String() string
func (*DirectiveCron) Validate ¶ added in v0.12.0
func (d *DirectiveCron) Validate() error
type DirectiveMiddleware ¶ added in v0.1.0
type DirectiveMiddleware struct {
Labels []string `parser:"'middleware' @Ident*"`
}
func (*DirectiveMiddleware) String ¶ added in v0.1.0
func (d *DirectiveMiddleware) String() string
func (*DirectiveMiddleware) Validate ¶ added in v0.1.0
func (d *DirectiveMiddleware) Validate() error
type DirectiveProvider ¶
type DirectiveProvider struct { Weak bool `parser:"'provider' ( @'weak'"` Multi bool `parser:" | @'multi'"` Require []string `parser:" | 'require' '=' (@Ident | @String) (',' (@Ident | @String))*)*"` }
func (*DirectiveProvider) String ¶
func (p *DirectiveProvider) String() string
func (*DirectiveProvider) Validate ¶
func (p *DirectiveProvider) Validate() error
type DirectiveSubscribe ¶ added in v0.21.0
type DirectiveSubscribe struct {
Subscribe bool `parser:"'subscribe'"`
}
func (*DirectiveSubscribe) String ¶ added in v0.21.0
func (d *DirectiveSubscribe) String() string
func (*DirectiveSubscribe) Validate ¶ added in v0.21.0
func (d *DirectiveSubscribe) Validate() error
type LiteralSegment ¶
type LiteralSegment struct {
Literal string `parser:"'/' @~(' ' | '/')+"`
}
func (LiteralSegment) String ¶
func (l LiteralSegment) String() string
type Segment ¶
type Segment interface { String() string // contains filtered or unexported methods }
type TrailingSegment ¶
type TrailingSegment struct {
Anonymous string `parser:"'/'"`
}
TrailingSegment represents a trailing terminating /
func (TrailingSegment) String ¶
func (a TrailingSegment) String() string
type WildcardSegment ¶
type WildcardSegment struct { Name string `parser:"'/' '{' @(Ident | Method)"` Remainder bool `parser:"@'...'? '}'"` }
func (WildcardSegment) String ¶
func (w WildcardSegment) String() string
Click to show internal directories.
Click to hide internal directories.