nqm_parser

package
Version: v0.0.0-...-629276b Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2016 License: Apache-2.0 Imports: 11 Imported by: 4

Documentation

Index

Constants

View Source
const FORMAT_ERROR_LOCATION_FILTER = "%v filter for provinces:%v and cities:%v are both set"

Checks the paramters

1. provinces and cities cannot be assigned at the same time 2. duplicated value would be eliminated

Variables

This section is empty.

Functions

func Parse

func Parse(filename string, b []byte, opts ...Option) (interface{}, error)

Parse parses the data from b using filename as information in the error messages.

func ParseFile

func ParseFile(filename string, opts ...Option) (interface{}, error)

ParseFile parses the file identified by filename.

func ParseReader

func ParseReader(filename string, r io.Reader, opts ...Option) (interface{}, error)

ParseReader parses the data from r using filename as information in the error messages.

Types

type HostRelation

type HostRelation int8

Defines the IR for relation of hosts(between agent and target)

const (
	// The relation is unknown
	UNKNOWN_RELATION HostRelation = -1
	// Means a property of agent and target must be same
	SAME_VALUE HostRelation = 1
	// Means a property of agent and target may not be same
	NOT_SAME_VALUE HostRelation = 2
)

type NodeFilter

type NodeFilter struct {
	MatchProvinces []string
	MatchCities    []string
	MatchIsps      []string
}

The filter of node

type NodeFilterById

type NodeFilterById struct {
	MatchIds       []int32
	MatchProvinces []int16
	MatchCities    []int16
	MatchIsps      []int16
}

The filter of node

type Option

type Option func(*parser) Option

Option is a function that can set an option on the parser. It returns the previous setting as an Option.

func Debug

func Debug(b bool) Option

Debug creates an Option to set the debug flag to b. When set to true, debugging information is printed to stdout while parsing.

The default is false.

func Memoize

func Memoize(b bool) Option

Memoize creates an Option to set the memoize flag to b. When set to true, the parser will cache all results so each expression is evaluated only once. This guarantees linear parsing time even for pathological cases, at the expense of more memory and slower times for typical cases.

The default is false.

func Recover

func Recover(b bool) Option

Recover creates an Option to set the recover flag to b. When set to true, this causes the parser to recover from panics and convert it to an error. Setting it to false can be useful while debugging to access the full stack trace.

The default is true.

type QueryParams

type QueryParams struct {
	StartTime        time.Time
	EndTime          time.Time
	AgentFilter      NodeFilter
	TargetFilter     NodeFilter
	AgentFilterById  NodeFilterById
	TargetFilterById NodeFilterById
	ProvinceRelation HostRelation
}

The parameters for query

func (*QueryParams) CheckRationalOfParameters

func (p *QueryParams) CheckRationalOfParameters() error

*

* Checks:
* 1. The end time must be after or equals the start time

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL