allot: github.com/sbstjn/allot Index | Files

package allot

import "github.com/sbstjn/allot"

Index

Package Files

command.go match.go parameter.go

func Expression Uses

func Expression(data string) *regexp.Regexp

Expression returns the regexp for a data type

type Command Uses

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

Command is a Command definition

func New Uses

func New(command string) Command

New returns a new command

func (Command) Expression Uses

func (c Command) Expression() *regexp.Regexp

Expression returns the regular expression matching the command text

func (Command) Has Uses

func (c Command) Has(param ParameterInterface) bool

Has checks if the parameter is found in the command

func (Command) Match Uses

func (c Command) Match(req string) (MatchInterface, error)

Match returns the parameter matching the expression at the defined position

func (Command) Matches Uses

func (c Command) Matches(req string) bool

Matches checks if a comand definition matches a request

func (Command) Parameters Uses

func (c Command) Parameters() []Parameter

Parameters returns the list of defined parameters

func (Command) Position Uses

func (c Command) Position(param ParameterInterface) int

Position returns the position of a parameter

func (Command) Text Uses

func (c Command) Text() string

Text returns the command text

type CommandInterface Uses

type CommandInterface interface {
    Expression() *regexp.Regexp
    Has(name ParameterInterface) bool
    Match(req string) (MatchInterface, error)
    Matches(req string) bool
    Parameters() []Parameter
    Position(param ParameterInterface) int
    Text() string
}

CommandInterface describes how to access a Command

type Match Uses

type Match struct {
    Command CommandInterface
    Request string
}

Match is the Match definition

func (Match) Integer Uses

func (m Match) Integer(name string) (int, error)

Integer returns the value for an integer parameter

func (Match) Match Uses

func (m Match) Match(position int) (string, error)

Match returns the match at given position

func (Match) Parameter Uses

func (m Match) Parameter(param ParameterInterface) (string, error)

Parameter returns the value for a parameter

func (Match) String Uses

func (m Match) String(name string) (string, error)

String returns the value for a string parameter

type MatchInterface Uses

type MatchInterface interface {
    String(name string) (string, error)
    Integer(name string) (int, error)
    Match(position int) (string, error)

    Parameter(param ParameterInterface) (string, error)
}

MatchInterface describes how to access a Match

type Parameter Uses

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

Parameter is the Parameter definition

func NewParameterWithType Uses

func NewParameterWithType(name string, data string) Parameter

NewParameterWithType returns

func Parse Uses

func Parse(text string) Parameter

Parse parses parameter info

func (Parameter) Data Uses

func (p Parameter) Data() string

Data returns the Parameter name

func (Parameter) Equals Uses

func (p Parameter) Equals(param ParameterInterface) bool

Equals checks if two parameter are equal

func (Parameter) Expression Uses

func (p Parameter) Expression() *regexp.Regexp

Expression returns the regexp behind the type

func (Parameter) Name Uses

func (p Parameter) Name() string

Name returns the Parameter name

type ParameterInterface Uses

type ParameterInterface interface {
    Equals(param ParameterInterface) bool
    Expression() *regexp.Regexp
    Name() string
    Data() string
}

ParameterInterface describes how to access a Parameter

Package allot imports 5 packages (graph) and is imported by 1 packages. Updated 2018-08-02. Refresh now. Tools for package owners.