Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EncounteredStats ¶
type EncounteredStats struct { TimesSeen atomic.Int64 `json:"times_seen"` TimesMatched atomic.Int64 `json:"times_matched"` Examples *ExampleList `json:"examples,omitempty"` }
type ExampleList ¶
type ExampleList struct {
// contains filtered or unexported fields
}
func (*ExampleList) Get ¶
func (el *ExampleList) Get() []string
type FieldStats ¶
type FieldStats struct { Expecting []expectedType `json:"expecting"` TimesSampled atomic.Int64 `json:"times_sampled"` TypesEnountered [numEncounteredTypes]EncounteredStats `json:"types_encountered"` }
TODO: Replace uber types with native types pending MarshalScalar (see field_stats.go)
func NewFieldStats ¶
func NewFieldStats(expectedTypes ...expectedType) *FieldStats
func (*FieldStats) MarshalJson ¶
func (n *FieldStats) MarshalJson() ([]byte, error)
type MatchStats ¶
type MatchStats struct { NodeName string `json:"node_name"` TimesChecked int64 `json:"times_checked"` TimesMatched int64 `json:"times_matched"` Children []*MatchStats `json:"children,omitempty"` }
type Matcher ¶
type Matcher struct {
// contains filtered or unexported fields
}
Matcher performs an AQL query against JSON to see if it matches
Example ¶
const json = `{ "date": "1970-01-02", "number": 2, "name": "Andy", "description": "大懒虫" }` m, err := NewMatcher(`name:"andy" AND date:><(1970-01-01,1980-01-01)`) if err != nil { log.Fatalf("error running query: %v", err) } result, err := m.Match([]byte(json)) if err != nil { log.Fatalf("error during match: %v", err) } fmt.Println(result)
Output: true
func NewMatcher ¶
NewMatcher creates a new matcher that returns whether a JSON document matches an AQL query
func (*Matcher) Messages ¶
func (m *Matcher) Messages() []*parser.ParserMessage
Messages will return any hints or warning messages that the matcher may have generated during parsing
func (*Matcher) Stats ¶
func (m *Matcher) Stats() *MatchStats
type MatcherOption ¶
func TrackQueryStats ¶
func TrackQueryStats() MatcherOption
type VelueProvider ¶
TODO: research implementing Impl [JSON]ValueProvider
Source Files
¶
Click to show internal directories.
Click to hide internal directories.