sqlquery

package
v0.0.0-...-62bf4b9 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package sqlquery handles parsing SQL and converting to a dialect for Tidalwave.

Package sqlquery handles parsing SQL and converting to a dialect for Tidalwave.

Package sqlquery handles parsing SQL and converting to a dialect for Tidalwave.

Index

Constants

View Source
const (
	// TypeCount specifies result is a count result
	TypeCount = "count"
	// TypeDistinct specifies result is a distinct result
	TypeDistinct = "distinct"
	// TypeCountDistinct specifies result is a count distinct result
	TypeCountDistinct = "count-distinct"
	// TypeSearch specifies specifies result is a search result
	TypeSearch = "search"

	// OperatorBetween constant.
	OperatorBetween = "between"
	// OperatorIn constant.
	OperatorIn = "in"
)

Variables

This section is empty.

Functions

func ProcessDate

func ProcessDate(d *DateParam, logDate moment.Moment, dateOnly bool) bool

ProcessDate handles processing a date in a query

func ProcessInt

func ProcessInt(q *QueryParam, res int) bool

ProcessInt handles processing an integer in a query

func ProcessString

func ProcessString(q *QueryParam, res string) bool

ProcessString handles processing a string for a query

Types

type DateParam

type DateParam struct {
	Date     string
	DateTime *moment.Moment
	Operator string
	TimeUsed bool
	Type     string
}

DateParam stores date query information.

type QueryParam

type QueryParam struct {
	IsInt          bool
	KeyName        string
	KeyPath        string
	Regex          *regexp.Regexp
	Operator       string
	ValInt         int
	ValIntArray    []int
	ValString      string
	ValStringArray []string
}

QueryParam holds a single piece of a queries WHERE and SELECT statements to be processed on log lines

type QueryParams

type QueryParams struct {
	SQLString      string
	SQLStringLower string

	From []string // TODO: Rename to Froms

	AggrPath  string
	Dates     []DateParam
	Queries   []QueryParam // TODO Rename to Where
	QueryKeys []string
	Selects   []string
	Type      string
}

QueryParams holds all the information for a given query such SELECT, FROM, and WHERE statements to be easily processed later.

func New

func New(queryString string) *QueryParams

New parses a query string and returns a newly created QueryParams struc holding all parsed data.

func (*QueryParams) ProcessLine

func (qp *QueryParams) ProcessLine(line *[]byte) bool

ProcessLine interates through all Queries created during the query parsing returning a bool stating whether all matched.

Jump to

Keyboard shortcuts

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