internal

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package internal implements Exec, executing SQL-like queries on a given database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComposeProjection

func ComposeProjection(db ds.Database, k string, v *vdl.Value, s *queryparser.SelectClause) []*vom.RawBytes

Given a key, a value and a SelectClause, return the projection. This function is only called if Eval returned true on the WhereClause expression.

func Create

func Create(db ds.Database) public.QueryEngine

func Eval

func Eval(db ds.Database, k string, v *vdl.Value, e *queryparser.Expression) bool

func Exec

func Exec(db ds.Database, q string) ([]string, syncql.ResultStream, error)

func ExecSelectSingleRow

func ExecSelectSingleRow(db ds.Database, k string, v *vdl.Value, s *queryparser.SelectStatement) []*vom.RawBytes

For testing purposes, given a SelectStatement, k and v; return nil if row not selected, else return the projection (type []*vdl.Value). Note: limit and offset clauses are ignored for this function as they make no sense for a single row.

func ResolveField

func ResolveField(db ds.Database, k string, v *vdl.Value, f *queryparser.Field) *vdl.Value

Resolve a field.

Types

type EvalWithKeyResult

type EvalWithKeyResult int

EvalWhereUsingOnlyKey return type. See that function for details.

const (
	Include EvalWithKeyResult = iota
	Exclude
	FetchValue
)

func EvalWhereUsingOnlyKey

func EvalWhereUsingOnlyKey(db ds.Database, w *queryparser.WhereClause, k string) EvalWithKeyResult

Evaluate the where clause to determine if the row should be selected, but do so using only the key. Possible returns are: Include: the row should Included in the results Exclude: the row should NOT be Included FetchValue: the value and/or type of the value are required to determine if row should be Included. The above decision is accomplished by evaluating all expressions which compare the key with a string literal and substituing false for all other expressions. If the result is true, Include is returned. If the result is false, but no other expressions were encountered, Exclude is returned; else, FetchValue is returned indicating the value must be fetched in order to determine if the row should be Included in the results.

Directories

Path Synopsis
Package querychecker performs a semantic check on an AST produced by the queryparser package.
Package querychecker performs a semantic check on an AST produced by the queryparser package.
Package queryfunctions describes SyncQL's built-in functions.
Package queryfunctions describes SyncQL's built-in functions.
Package queryparser is a parser to parse a simplified select statement (a la SQL) for the Vanadium key value store (a.k.a., syncbase).
Package queryparser is a parser to parse a simplified select statement (a la SQL) for the Vanadium key value store (a.k.a., syncbase).
Package query_test contains tests for the query package.
Package query_test contains tests for the query package.

Jump to

Keyboard shortcuts

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