directive

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAllowedForRootContext

func IsAllowedForRootContext(child Enumeration) bool

func IsArrayOfTypes

func IsArrayOfTypes(b bytes.Bytes) bool

func IsHTTPResponseCode

func IsHTTPResponseCode(s string) bool

func IsStartWithDirective

func IsStartWithDirective(b bytes.Bytes) bool

Types

type Coords

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

func NewCoords

func NewCoords(f *fs.File, b bytes.Index, e bytes.Index) Coords

func (Coords) B

func (c Coords) B() bytes.Index

func (Coords) File

func (c Coords) File() *fs.File

func (Coords) IsSet

func (c Coords) IsSet() bool

func (Coords) Read

func (c Coords) Read() bytes.Bytes

func (Coords) String

func (c Coords) String() string

type Directive

type Directive struct {
	Annotation string

	// Keyword only for Responses (have multiple keywords), for others should match
	// type.
	Keyword string

	BodyCoords Coords
	Parent     *Directive
	Children   []*Directive

	// HasExplicitContext true if directive's context is opened explicitly with parentheses.
	HasExplicitContext bool
	// contains filtered or unexported fields
}

Directive represents all info about some Directive

func New

func New(e Enumeration, keywordCoords Coords) *Directive

func (*Directive) AppendChild

func (d *Directive) AppendChild(child *Directive)

func (*Directive) AppendParameter

func (d *Directive) AppendParameter(b bytes.Bytes) error

func (Directive) BodyError

func (d Directive) BodyError(msg string) *jerr.JAPIError

func (Directive) BodyErrorIndex

func (d Directive) BodyErrorIndex(msg string, i uint) *jerr.JAPIError

func (Directive) CopyWoParentAndChildren

func (d Directive) CopyWoParentAndChildren() Directive

func (Directive) Equal

func (d Directive) Equal(d2 Directive) bool

func (Directive) HasAnyParameters

func (d Directive) HasAnyParameters() bool

func (Directive) KeywordError

func (d Directive) KeywordError(msg string) *jerr.JAPIError

func (Directive) Method

func (d Directive) Method() (Enumeration, error)

func (Directive) Parameter

func (d Directive) Parameter(k string) string

func (Directive) ParameterError

func (d Directive) ParameterError(msg string) *jerr.JAPIError

func (Directive) Path

func (d Directive) Path() (string, error)

func (*Directive) SetParameter

func (d *Directive) SetParameter(k string, v string) error

func (Directive) String

func (d Directive) String() string

func (Directive) Type

func (d Directive) Type() Enumeration

type Directives

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

Directives represent available directives. gen:OrderedMap

func (*Directives) Each

func (m *Directives) Each(fn eachDirectivesFunc) error

Each iterates and perform given function on each item in the map.

func (*Directives) EachReverse

func (m *Directives) EachReverse(fn eachDirectivesFunc) error

EachReverse act almost the same as Each but in reverse order.

func (*Directives) EachSafe

func (m *Directives) EachSafe(fn eachSafeDirectivesFunc)

func (*Directives) Find

func (m *Directives) Find(fn findDirectivesFunc) (DirectivesItem, bool)

Find finds first matched item from the map.

func (*Directives) Get

func (m *Directives) Get(k string) (*Directive, bool)

Get gets a value by key.

func (*Directives) GetValue

func (m *Directives) GetValue(k string) *Directive

GetValue gets a value by key.

func (*Directives) Has

func (m *Directives) Has(k string) bool

Has checks that specified key is set.

func (*Directives) Len

func (m *Directives) Len() int

Len returns count of values.

func (*Directives) Map

func (m *Directives) Map(fn mapDirectivesFunc) error

Map iterates and changes values in the map.

func (*Directives) MarshalJSON

func (m *Directives) MarshalJSON() ([]byte, error)

func (*Directives) Set

func (m *Directives) Set(k string, v *Directive)

Set sets a value with specified key.

func (*Directives) SetToTop

func (m *Directives) SetToTop(k string, v *Directive)

SetToTop do the same as Set, but new key will be placed on top of the order map.

func (*Directives) Update

func (m *Directives) Update(k string, fn func(v *Directive) *Directive)

Update updates a value with specified key.

type DirectivesItem

type DirectivesItem struct {
	Key   string
	Value *Directive
}

DirectivesItem represent single data from the Directives.

type Enumeration

type Enumeration int
const (
	Jsight Enumeration = iota
	Info
	Title
	Version
	Description
	Server
	BaseUrl
	Url
	Get
	Post
	Put
	Patch
	Delete
	Body
	Request
	HTTPResponseCode
	Path
	Headers
	Query
	Type
	Enum
	Macro
	Paste
)

func NewDirectiveType

func NewDirectiveType(s string) (Enumeration, error)

func (Enumeration) IsAllowedForDirectiveContext

func (de Enumeration) IsAllowedForDirectiveContext(child Enumeration) bool

func (Enumeration) IsHTTPRequestMethod

func (de Enumeration) IsHTTPRequestMethod() bool

func (Enumeration) String

func (de Enumeration) String() string

Jump to

Keyboard shortcuts

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