bql

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package bql implements parsing and pluggable interpretation for the Brief query language (abbreviated "BQL"), a small LISP-style language to specify mail queries.

Example:

(or (and date=yesterday from=person1) from=person2)

Equivalently written (to be more shell-friendly):

grp or grp and date=yesterday from=person1 prg from=person2 prg

Index

Constants

View Source
const (
	UNSORTED = Sorting(iota)
	DATE
	MODTIME
)

Variables

View Source
var ErrBadVerb = errors.New("bad verb")

TODO add semantics to the bql package

Functions

This section is empty.

Types

type BQL

type BQL interface {
	String() string
	// contains filtered or unexported methods
}

brief query language

func Parse

func Parse(args []string) (BQL, error)

type BQLAnd

type BQLAnd struct{ Qs []BQL }

func (BQLAnd) String

func (and BQLAnd) String() string

type BQLEmpty

type BQLEmpty struct{}

func (BQLEmpty) String

func (empty BQLEmpty) String() string

type BQLNot

type BQLNot struct{ Qs []BQL }

func (BQLNot) String

func (not BQLNot) String() string

type BQLOr

type BQLOr struct{ Qs []BQL }

func (BQLOr) String

func (or BQLOr) String() string

type BQLQry

type BQLQry struct{ Raw string }

func (BQLQry) String

func (qry BQLQry) String() string

type Context

type Context struct {
	Now           time.Time
	LookupAddress func(string) *mail.Address
}

TODO change BQL to BQLSyntax and fuse BQL with Context

type Query

type Query struct {
	Unoptimised BQL
	Context

	// TODO Rename "s/SortBy/Sorting/"?
	SortBy Sorting
}

func Compile

func Compile(context *Context, raw []string) (*Query, error)

context must not be nil

func QueryEverything

func QueryEverything() *Query

func QueryHot

func QueryHot() *Query

func QueryMailbox

func QueryMailbox(mailbox string) *Query

func QueryMailboxINBOX

func QueryMailboxINBOX() *Query

func QueryTransferStatusIndeterminate

func QueryTransferStatusIndeterminate() *Query

func QueryTransferStatusOutgoing

func QueryTransferStatusOutgoing() *Query

func (*Query) Match

func (q *Query) Match(header headersemantics.Header, docket msgs.Docket, body io.Reader) (matched bool, err error)

header is recommended to be lazy and QuickHeader-infused. body is recommended to be lazy.

func (Query) String

func (q Query) String() string

type Sorting

type Sorting int

Directories

Path Synopsis
Package pl ("parantheses language") implements semantics-free S-expressions.
Package pl ("parantheses language") implements semantics-free S-expressions.

Jump to

Keyboard shortcuts

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