goql

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: MIT Imports: 11 Imported by: 1

README

goql

Simple multipurpose query language parser

Documentation

Index

Constants

View Source
const (
	EOF = iota
	WS
	OP_EQI  // == equal ignore space
	OP_EQ   // === equal
	OP_NEQI // != not equal ignore space
	OP_NEQ  // !== not equal
	OP_RX   // ~= match regular expression
	OP_RXN  // ~! not match regular expression
	OP_GT   // >
	OP_GE   // >=
	OP_LT   // <
	OP_LE   // <=
	LNK_AND // &
	LNK_OR  // |
	LNK_NOT // NOT
	LITERAL
	INTEGER
	FLOAT
	BOOLEAN
	TIME
	ILLEGAL
)

Variables

View Source
var ErrEmptyQuery = errors.New("query is empty, nothing to parse")

Functions

This section is empty.

Types

type Condition

type Condition struct {
	Link       Token
	Negate     bool
	Key        string
	Expression string
	ExprType   Token
	Operator   Token
}

type Conditions

type Conditions interface {
	String() string
	Add(thing *Condition)
	Equals(thing Conditions) bool
	AddDateFormat(format string)
	CheckMap(m map[string]interface{}) (bool, error)
	CheckStruct(s interface{}) (bool, error)
	Conditions() []*Condition
}

func NewConditions

func NewConditions() Conditions

type Parser

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

func NewParser

func NewParser(r io.Reader) *Parser

func (*Parser) Parse

func (p *Parser) Parse() (Conditions, error)

type Scanner

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

func NewScanner

func NewScanner(r io.Reader) *Scanner

func (Scanner) Scan

func (s Scanner) Scan() (Token, string)

type Token

type Token int

func (Token) String

func (t Token) String() string

Jump to

Keyboard shortcuts

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