query

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package query provides a simple query language for filtering records.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type And

type And struct {
	Queries []Query
	// contains filtered or unexported fields
}

func (*And) Match

func (q *And) Match(r api.Record) bool

func (*And) Optimize

func (q *And) Optimize() Query

func (*And) String

func (q *And) String() string

func (*And) TimeRange

func (q *And) TimeRange() (*time.Time, *time.Time)

type FieldQuery

type FieldQuery struct {
	Key   stringMatcher
	Value valueMatcher
}

func (*FieldQuery) Match

func (q *FieldQuery) Match(r api.Record) bool

func (*FieldQuery) Optimize

func (q *FieldQuery) Optimize() Query

func (*FieldQuery) String

func (q *FieldQuery) String() string

func (*FieldQuery) TimeRange

func (q *FieldQuery) TimeRange() (*time.Time, *time.Time)

type Not

type Not struct {
	Query Query
}

func (*Not) Match

func (q *Not) Match(r api.Record) bool

func (*Not) Optimize

func (q *Not) Optimize() Query

func (*Not) String

func (q *Not) String() string

func (*Not) TimeRange

func (q *Not) TimeRange() (*time.Time, *time.Time)

type Or

type Or struct {
	Queries []Query
}

func (*Or) Match

func (q *Or) Match(r api.Record) bool

func (*Or) Optimize

func (q *Or) Optimize() Query

func (*Or) String

func (q *Or) String() string

func (*Or) TimeRange

func (q *Or) TimeRange() (*time.Time, *time.Time)

type Query

type Query interface {
	fmt.Stringer

	Match(api.Record) bool
	Optimize() Query
	TimeRange() (*time.Time, *time.Time)
}

func ParseQuery

func ParseQuery(query string) Query

type SimpleQuery

type SimpleQuery struct {
	Value valueMatcher
}

func (*SimpleQuery) Match

func (q *SimpleQuery) Match(r api.Record) bool

func (*SimpleQuery) Optimize

func (q *SimpleQuery) Optimize() Query

func (*SimpleQuery) String

func (q *SimpleQuery) String() string

func (*SimpleQuery) TimeRange

func (q *SimpleQuery) TimeRange() (*time.Time, *time.Time)

type TimeRange

type TimeRange struct {
	Start *time.Time
	End   *time.Time
}

Jump to

Keyboard shortcuts

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