query

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2017 License: MIT Imports: 25 Imported by: 9

Documentation

Index

Constants

View Source
const (
	ERROR_MESSAGE_TEMPLATE                     = "[L:%d C:%d] %s"
	ERROR_MESSAGE_WITH_FILEPATH_TEMPLATE       = "%s [L:%d C:%d] %s"
	ERROR_MESSAGE_WITH_EMPTY_POSITION_TEMPLATE = "[L:- C:-] %s"

	ERROR_INVALID_SYNTAX                    = "syntax error: unexpected %s"
	ERROR_READ_FILE                         = "failed to read from file: %s"
	ERROR_WRITE_FILE                        = "failed to write to file: %s"
	ERROR_WRITE_FILE_IN_AUTOCOMMIT          = "[Auto-Commit] failed to write to file: %s"
	ERROR_FIELD_AMBIGUOUS                   = "field %s is ambiguous"
	ERROR_FIELD_NOT_EXIST                   = "field %s does not exist"
	ERROR_FIELD_NOT_GROUP_KEY               = "field %s is not a group key"
	ERROR_FIELD_NUMBER_NOT_EXIST            = "field number %s does not exist"
	ERROR_FIELD_NUMBER_NOT_GROUP_KEY        = "field number %s is not a group key"
	ERROR_DUPLICATE_FIELD_NAME              = "field name %s is a duplicate"
	ERROR_NOT_GROUPING_RECORDS              = "function %s cannot aggregate not grouping records"
	ERROR_UNDEFINED_VARIABLE                = "variable %s is undefined"
	ERROR_VARIABLE_REDECLARED               = "variable %s is redeclared"
	ERROR_FUNCTION_NOT_EXIST                = "function %s does not exist"
	ERROR_FUNCTION_ARGUMENT_LENGTH          = "function %s takes %s"
	ERROR_FUNCTION_INVALID_ARGUMENT         = "%s for function %s"
	ERROR_UNPERMITTED_STATEMENT_FUNCTION    = "function %s cannot be used as a statement"
	ERROR_NESTED_AGGREGATE_FUNCTIONS        = "aggregate functions are nested at %s"
	ERROR_FUNCTION_REDECLARED               = "function %s is redeclared"
	ERROR_BUILT_IN_FUNCTION_DECLARED        = "function %s is a built-in function"
	ERROR_DUPLICATE_PARAMETER               = "parameter %s is a duplicate"
	ERROR_SUBQUERY_TOO_MANY_RECORDS         = "subquery returns too many records, should return only one record"
	ERROR_SUBQUERY_TOO_MANY_FIELDS          = "subquery returns too many fields, should return only one field"
	ERROR_CURSOR_REDECLARED                 = "cursor %s is redeclared"
	ERROR_UNDEFINED_CURSOR                  = "cursor %s is undefined"
	ERROR_CURSOR_CLOSED                     = "cursor %s is closed"
	ERROR_CURSOR_OPEN                       = "cursor %s is already open"
	ERROR_PSEUDO_CURSOR                     = "cursor %s is a pseudo cursor"
	ERROR_CURSOR_FETCH_LENGTH               = "fetching from cursor %s returns %s"
	ERROR_INVALID_FETCH_POSITION            = "fetching position %s is not an integer value"
	ERROR_INLINE_TABLE_REDECLARED           = "inline table %s is redeclared"
	ERROR_UNDEFINED_INLINE_TABLE            = "inline table %s is undefined"
	ERROR_INLINE_TABLE_FIELD_LENGTH         = "select query should return exactly %s for inline table %s"
	ERROR_FILE_NOT_EXIST                    = "file %s does not exist"
	ERROR_FILE_ALREADY_EXIST                = "file %s already exists"
	ERROR_FILE_UNABLE_TO_READ               = "file %s is unable to be read"
	ERROR_CSV_PARSING                       = "csv parse error in file %s: %s"
	ERROR_TEMPORARY_TABLE_REDECLARED        = "temporary table %s is redeclared"
	ERROR_UNDEFINED_TEMPORARY_TABLE         = "temporary table %s is undefined"
	ERROR_TEMPORARY_TABLE_FIELD_LENGTH      = "select query should return exactly %s for temporary table %s"
	ERROR_DUPLICATE_TABLE_NAME              = "table name %s is a duplicate"
	ERROR_TABLE_NOT_LOADED                  = "table %s is not loaded"
	ERROR_STDIN_EMPTY                       = "stdin is empty"
	ERROR_ROW_VALUE_LENGTH_IN_COMPARISON    = "row value should contain exactly %s"
	ERROR_SELECT_FIELD_LENGTH_IN_COMPARISON = "select query should return exactly %s"
	ERROR_INVALID_LIMIT_PERCENTAGE          = "limit percentage %s is not a float value"
	ERROR_INVALID_LIMIT_NUMBER              = "limit number of records %s is not an integer value"
	ERROR_INVALID_OFFSET_NUMBER             = "offset number %s is not an integer value"
	ERROR_COMBINED_SET_FIELD_LENGTH         = "result set to be combined should contain exactly %s"
	ERROR_INSERT_ROW_VALUE_LENGTH           = "row value should contain exactly %s"
	ERROR_INSERT_SELECT_FIELD_LENGTH        = "select query should return exactly %s"
	ERROR_UPDATE_FIELD_NOT_EXIST            = "field %s does not exist in the tables to update"
	ERROR_UPDATE_VALUE_AMBIGUOUS            = "value %s to set in the field %s is ambiguous"
	ERROR_DELETE_TABLE_NOT_SPECIFIED        = "tables to delete records are not specified"
	ERROR_PRINTF_REPLACE_VALUE_LENGTH       = "PRINTF: %s"
	ERROR_SOURCE_INVALID_ARGUMENT           = "SOURCE: argument %s is not a string"
	ERROR_SOURCE_FILE_NOT_EXIST             = "SOURCE: file %s does not exist"
	ERROR_SOURCE_FILE_UNABLE_TO_READ        = "SOURCE: file %s is unable to read"
	ERROR_INVALID_FLAG_NAME                 = "SET: flag name %s is invalid"
	ERROR_INVALID_FLAG_VALUE                = "SET: flag value %s for %s is invalid"
	ERROR_INTERNAL_RECORD_ID_NOT_EXIST      = "internal record id does not exist"
	ERROR_INTERNAL_RECORD_ID_EMPTY          = "internal record id is empty"
	ERROR_FIELD_LENGTH_NOT_MATCH            = "field length does not match"
	ERROR_ROW_VALUE_LENGTH_NOT_MATCH        = "row value length does not match"
	ERROR_ROW_VALUE_LENGTH_IN_LIST          = "row value length does not match at index %d"
	ERROR_FORMAT_STRING_LENGTH_NOT_MATCH    = "number of replace values does not match"
)
View Source
const INTERNAL_ID_COLUMN = "@__internal_id"

Variables

View Source
var AggregateFunctions = map[string]AggregateFunction{
	"COUNT":  Count,
	"MAX":    Max,
	"MIN":    Min,
	"SUM":    Sum,
	"AVG":    Avg,
	"MEDIAN": Median,
}
View Source
var AnalyticFunctions map[string]AnalyticFunction = map[string]AnalyticFunction{
	"ROW_NUMBER":   RowNumber{},
	"RANK":         Rank{},
	"DENSE_RANK":   DenseRank{},
	"CUME_DIST":    CumeDist{},
	"PERCENT_RANK": PercentRank{},
	"NTILE":        NTile{},
	"FIRST_VALUE":  FirstValue{},
	"LAST_VALUE":   LastValue{},
	"NTH_VALUE":    NthValue{},
	"LAG":          Lag{},
	"LEAD":         Lead{},
	"LISTAGG":      AnalyticListAgg{},
}
View Source
var Functions = map[string]func(parser.Function, []parser.Primary) (parser.Primary, error){
	"COALESCE":         Coalesce,
	"IF":               If,
	"IFNULL":           Ifnull,
	"NULLIF":           Nullif,
	"CEIL":             Ceil,
	"FLOOR":            Floor,
	"ROUND":            Round,
	"ABS":              Abs,
	"ACOS":             Acos,
	"ASIN":             Asin,
	"ATAN":             Atan,
	"ATAN2":            Atan2,
	"COS":              Cos,
	"SIN":              Sin,
	"TAN":              Tan,
	"EXP":              Exp,
	"EXP2":             Exp2,
	"EXPM1":            Expm1,
	"LOG":              Log,
	"LOG10":            Log10,
	"LOG2":             Log2,
	"LOG1P":            Log1p,
	"SQRT":             Sqrt,
	"POW":              Pow,
	"BIN_TO_DEC":       BinToDec,
	"OCT_TO_DEC":       OctToDec,
	"HEX_TO_DEC":       HexToDec,
	"ENOTATION_TO_DEC": EnotationToDec,
	"BIN":              Bin,
	"OCT":              Oct,
	"HEX":              Hex,
	"ENOTATION":        Enotation,
	"RAND":             Rand,
	"TRIM":             Trim,
	"LTRIM":            Ltrim,
	"RTRIM":            Rtrim,
	"UPPER":            Upper,
	"LOWER":            Lower,
	"BASE64_ENCODE":    Base64Encode,
	"BASE64_DECODE":    Base64Decode,
	"HEX_ENCODE":       HexEncode,
	"HEX_DECODE":       HexDecode,
	"LEN":              Len,
	"BYTE_LEN":         ByteLen,
	"LPAD":             Lpad,
	"RPAD":             Rpad,
	"SUBSTR":           Substr,
	"REPLACE":          Replace,
	"FORMAT":           Format,
	"MD5":              Md5,
	"SHA1":             Sha1,
	"SHA256":           Sha256,
	"SHA512":           Sha512,
	"MD5_HMAC":         Md5Hmac,
	"SHA1_HMAC":        Sha1Hmac,
	"SHA256_HMAC":      Sha256Hmac,
	"SHA512_HMAC":      Sha512Hmac,
	"NOW":              Now,
	"DATETIME_FORMAT":  DatetimeFormat,
	"YEAR":             Year,
	"MONTH":            Month,
	"DAY":              Day,
	"HOUR":             Hour,
	"MINUTE":           Minute,
	"SECOND":           Second,
	"MILLISECOND":      Millisecond,
	"MICROSECOND":      Microsecond,
	"NANOSECOND":       Nanosecond,
	"WEEKDAY":          Weekday,
	"UNIX_TIME":        UnixTime,
	"UNIX_NANO_TIME":   UnixNanoTime,
	"DAY_OF_YEAR":      DayOfYear,
	"WEEK_OF_YEAR":     WeekOfYear,
	"ADD_YEAR":         AddYear,
	"ADD_MONTH":        AddMonth,
	"ADD_DAY":          AddDay,
	"ADD_HOUR":         AddHour,
	"ADD_MINUTE":       AddMinute,
	"ADD_SECOND":       AddSecond,
	"ADD_MILLI":        AddMilli,
	"ADD_MICRO":        AddMicro,
	"ADD_NANO":         AddNano,
	"DATE_DIFF":        DateDiff,
	"TIME_DIFF":        TimeDiff,
	"STRING":           String,
	"INTEGER":          Integer,
	"FLOAT":            Float,
	"BOOLEAN":          Boolean,
	"TERNARY":          Ternary,
	"DATETIME":         Datetime,
	"CALL":             Call,
}
View Source
var Logs = []string{}
View Source
var Results = []Result{}
View Source
var SelectLogs = []string{}
View Source
var ViewCache = ViewMap{}

Functions

func Abs

func Abs(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Acos

func Acos(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func AddDay

func AddDay(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func AddHour

func AddHour(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func AddLog added in v0.4.0

func AddLog(log string)

func AddMicro

func AddMicro(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func AddMilli

func AddMilli(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func AddMinute

func AddMinute(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func AddMonth

func AddMonth(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func AddNano

func AddNano(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func AddSecond

func AddSecond(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func AddSelectLog added in v0.4.4

func AddSelectLog(log string)

func AddYear

func AddYear(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func All

func All(value []parser.Primary, list [][]parser.Primary, operator string) (ternary.Value, error)

func Analyze added in v0.5.6

func Analyze(view *View, fn parser.AnalyticFunction) error

func Any

func Any(value []parser.Primary, list [][]parser.Primary, operator string) (ternary.Value, error)

func Asin

func Asin(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Atan

func Atan(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Atan2

func Atan2(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Avg

func Avg(list []parser.Primary) parser.Primary

func Base64Decode

func Base64Decode(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Base64Encode

func Base64Encode(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Bin

func Bin(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func BinToDec

func BinToDec(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Boolean

func Boolean(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func ByteLen

func ByteLen(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Calculate

func Calculate(p1 parser.Primary, p2 parser.Primary, operator int) parser.Primary

func Call added in v0.1.8

func Call(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Ceil

func Ceil(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func CheckArgsLen added in v0.5.6

func CheckArgsLen(expr parser.AnalyticFunction, length []int) error

func Coalesce

func Coalesce(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Compare

func Compare(p1 parser.Primary, p2 parser.Primary, operator string) ternary.Value

func CompareRowValues added in v0.2.2

func CompareRowValues(v1 []parser.Primary, v2 []parser.Primary, operator string) (ternary.Value, error)

func Cos

func Cos(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Count

func Count(list []parser.Primary) parser.Primary

func CrossJoin

func CrossJoin(view *View, joinView *View)

func DateDiff

func DateDiff(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Datetime

func Datetime(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func DatetimeFormat

func DatetimeFormat(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Day

func Day(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func DayOfYear

func DayOfYear(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func DeclareTable added in v0.2.9

func DeclareTable(expr parser.TableDeclaration, filter Filter) error

func Distinguish added in v0.4.10

func Distinguish(list []parser.Primary) []parser.Primary

func EncodeView added in v0.1.6

func EncodeView(view *View, format cmd.Format, delimiter rune, withoutHeader bool, encoding cmd.Encoding, lineBreak cmd.LineBreak) (string, error)

func Enotation added in v0.5.12

func Enotation(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func EnotationToDec added in v0.5.12

func EnotationToDec(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func EqualTo

func EqualTo(p1 parser.Primary, p2 parser.Primary) ternary.Value

func EquivalentTo

func EquivalentTo(p1 parser.Primary, p2 parser.Primary) ternary.Value

func Execute

func Execute(input string, sourceFile string) (string, string, error)

func Exp

func Exp(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Exp2

func Exp2(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Expm1

func Expm1(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func FetchCursor added in v0.1.8

func FetchCursor(name parser.Identifier, fetchPosition parser.Expression, vars []parser.Variable, filter Filter) (bool, error)

func Float

func Float(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Floor

func Floor(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Format added in v0.5.0

func Format(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func FormatCount added in v0.4.3

func FormatCount(i int, obj string) string

func FormatString added in v0.5.0

func FormatString(format string, args []parser.Primary) (string, error)

func GreaterThan

func GreaterThan(p1 parser.Primary, p2 parser.Primary) ternary.Value

func GreaterThanOrEqualTo

func GreaterThanOrEqualTo(p1 parser.Primary, p2 parser.Primary) ternary.Value

func Hex

func Hex(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func HexDecode

func HexDecode(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func HexEncode

func HexEncode(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func HexToDec

func HexToDec(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Hour

func Hour(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func If

func If(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Ifnull

func Ifnull(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func InIntSlice added in v0.1.6

func InIntSlice(i int, list []int) bool

func InRowValueList added in v0.2.2

func InRowValueList(value []parser.Primary, list [][]parser.Primary, matchType int, operator string) (ternary.Value, error)

func InRuneSlice added in v0.5.12

func InRuneSlice(r rune, list []rune) bool

func InStrSliceWithCaseInsensitive added in v0.4.3

func InStrSliceWithCaseInsensitive(s string, list []string) bool

func InnerJoin

func InnerJoin(view *View, joinView *View, condition parser.Expression, parentFilter Filter) error

func Integer

func Integer(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Is

func IsReadableFromStdin added in v0.4.5

func IsReadableFromStdin() bool

func Len

func Len(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func LessThan

func LessThan(p1 parser.Primary, p2 parser.Primary) ternary.Value

func LessThanOrEqualTo

func LessThanOrEqualTo(p1 parser.Primary, p2 parser.Primary) ternary.Value

func Like

func ListAgg added in v0.4.9

func ListAgg(list []parser.Primary, separator string) parser.Primary

func Log

func Log(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Log10

func Log10(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Log1p

func Log1p(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Log2

func Log2(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Lower

func Lower(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Lpad

func Lpad(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Ltrim

func Ltrim(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Max

func Max(list []parser.Primary) parser.Primary

func Md5

func Md5(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Md5Hmac

func Md5Hmac(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Median added in v0.5.5

func Median(list []parser.Primary) parser.Primary

func Microsecond

func Microsecond(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Millisecond

func Millisecond(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Min

func Min(list []parser.Primary) parser.Primary

func Minute

func Minute(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Month

func Month(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Nanosecond

func Nanosecond(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func NewAutoCommitError added in v0.4.9

func NewAutoCommitError(message string) error

func NewBuiltInFunctionDeclaredError added in v0.4.3

func NewBuiltInFunctionDeclaredError(expr parser.Identifier) error

func NewCombinedSetFieldLengthError added in v0.4.3

func NewCombinedSetFieldLengthError(selectEntity parser.Expression, fieldLen int) error

func NewCsvParsingError added in v0.4.3

func NewCsvParsingError(file parser.Identifier, filepath string, message string) error

func NewCursorClosedError added in v0.4.3

func NewCursorClosedError(cursor parser.Identifier) error

func NewCursorFetchLengthError added in v0.4.3

func NewCursorFetchLengthError(cursor parser.Identifier, returnLen int) error

func NewCursorOpenError added in v0.4.3

func NewCursorOpenError(cursor parser.Identifier) error

func NewCursorRedeclaredError added in v0.4.3

func NewCursorRedeclaredError(cursor parser.Identifier) error

func NewDeleteTableNotSpecifiedError added in v0.4.3

func NewDeleteTableNotSpecifiedError(query parser.DeleteQuery) error

func NewDuplicateFieldNameError added in v0.4.3

func NewDuplicateFieldNameError(fieldName parser.Identifier) error

func NewDuplicateParameterError added in v0.5.0

func NewDuplicateParameterError(expr parser.Variable) error

func NewDuplicateTableNameError added in v0.4.3

func NewDuplicateTableNameError(table parser.Identifier) error

func NewFieldAmbiguousError added in v0.4.0

func NewFieldAmbiguousError(field parser.Expression) error

func NewFieldLengthNotMatchError added in v0.4.3

func NewFieldLengthNotMatchError() error

func NewFieldNotExistError added in v0.4.0

func NewFieldNotExistError(field parser.Expression) error

func NewFieldNotGroupKeyError added in v0.4.3

func NewFieldNotGroupKeyError(field parser.FieldReference) error

func NewFieldNumberNotExistError added in v0.4.6

func NewFieldNumberNotExistError(number parser.ColumnNumber) error

func NewFieldNumberNotGroupKeyError added in v0.4.6

func NewFieldNumberNotGroupKeyError(number parser.ColumnNumber) error

func NewFileAlreadyExistError added in v0.5.3

func NewFileAlreadyExistError(file parser.Identifier) error

func NewFileNotExistError added in v0.4.3

func NewFileNotExistError(file parser.Identifier) error

func NewFileUnableToReadError added in v0.4.3

func NewFileUnableToReadError(file parser.Identifier) error

func NewFormatStringLengthNotMatchError added in v0.5.0

func NewFormatStringLengthNotMatchError() error

func NewFunctionArgumentLengthError added in v0.4.3

func NewFunctionArgumentLengthError(expr parser.Expression, funcname string, argslen []int) error

func NewFunctionArgumentLengthErrorWithCustomArgs added in v0.4.3

func NewFunctionArgumentLengthErrorWithCustomArgs(expr parser.Expression, funcname string, argstr string) error

func NewFunctionInvalidArgumentError added in v0.4.3

func NewFunctionInvalidArgumentError(function parser.Expression, funcname string, message string) error

func NewFunctionNotExistError added in v0.4.3

func NewFunctionNotExistError(expr parser.Expression, funcname string) error

func NewFunctionRedeclaredError added in v0.4.3

func NewFunctionRedeclaredError(expr parser.Identifier) error

func NewInLineTableRedeclaredError added in v0.4.3

func NewInLineTableRedeclaredError(table parser.Identifier) error

func NewInlineTableFieldLengthError added in v0.4.3

func NewInlineTableFieldLengthError(query parser.SelectQuery, table parser.Identifier, fieldLen int) error

func NewInsertRowValueLengthError added in v0.4.3

func NewInsertRowValueLengthError(rowValue parser.RowValue, valueLen int) error

func NewInsertSelectFieldLengthError added in v0.4.3

func NewInsertSelectFieldLengthError(query parser.SelectQuery, fieldLen int) error

func NewInternalRecordIdEmptyError added in v0.4.3

func NewInternalRecordIdEmptyError() error

func NewInternalRecordIdNotExistError added in v0.4.3

func NewInternalRecordIdNotExistError() error

func NewInvalidFetchPositionError added in v0.4.3

func NewInvalidFetchPositionError(position parser.FetchPosition) error

func NewInvalidFlagNameError added in v0.4.3

func NewInvalidFlagNameError(setFlag parser.SetFlag) error

func NewInvalidFlagValueError added in v0.4.3

func NewInvalidFlagValueError(setFlag parser.SetFlag) error

func NewInvalidLimitNumberError added in v0.4.3

func NewInvalidLimitNumberError(clause parser.LimitClause) error

func NewInvalidLimitPercentageError added in v0.4.3

func NewInvalidLimitPercentageError(clause parser.LimitClause) error

func NewInvalidOffsetNumberError added in v0.4.3

func NewInvalidOffsetNumberError(clause parser.OffsetClause) error

func NewNestedAggregateFunctionsError added in v0.4.3

func NewNestedAggregateFunctionsError(expr parser.Expression) error

func NewNotGroupingRecordsError added in v0.4.3

func NewNotGroupingRecordsError(expr parser.Expression, funcname string) error

func NewPrintfReplaceValueLengthError added in v0.4.3

func NewPrintfReplaceValueLengthError(printf parser.Printf, message string) error

func NewPseudoCursorError added in v0.4.10

func NewPseudoCursorError(cursor parser.Identifier) error

func NewReadFileError added in v0.4.9

func NewReadFileError(expr parser.ProcExpr, message string) error

func NewRowValueLengthInComparisonError added in v0.4.3

func NewRowValueLengthInComparisonError(expr parser.Expression, valueLen int) error

func NewRowValueLengthInListError added in v0.4.3

func NewRowValueLengthInListError(i int) error

func NewRowValueLengthNotMatchError added in v0.4.3

func NewRowValueLengthNotMatchError() error

func NewSelectFieldLengthInComparisonError added in v0.4.3

func NewSelectFieldLengthInComparisonError(query parser.Subquery, valueLen int) error

func NewSourceFileNotExistError added in v0.4.3

func NewSourceFileNotExistError(source parser.Source, fpath string) error

func NewSourceFileUnableToReadError added in v0.4.3

func NewSourceFileUnableToReadError(source parser.Source, fpath string) error

func NewSourceInvalidArgumentError added in v0.4.10

func NewSourceInvalidArgumentError(source parser.Source, arg parser.Expression) error

func NewStdinEmptyError added in v0.4.3

func NewStdinEmptyError(stdin parser.Stdin) error

func NewSubqueryTooManyFieldsError added in v0.4.3

func NewSubqueryTooManyFieldsError(expr parser.Subquery) error

func NewSubqueryTooManyRecordsError added in v0.4.3

func NewSubqueryTooManyRecordsError(expr parser.Subquery) error

func NewSyntaxError added in v0.4.3

func NewSyntaxError(message string, line int, char int, sourceFile string) error

func NewSyntaxErrorFromExpr added in v0.4.3

func NewSyntaxErrorFromExpr(expr parser.Expression) error

func NewTableNotLoadedError added in v0.4.3

func NewTableNotLoadedError(table parser.Identifier) error

func NewTemporaryTableFieldLengthError added in v0.4.3

func NewTemporaryTableFieldLengthError(query parser.SelectQuery, table parser.Identifier, fieldLen int) error

func NewTemporaryTableRedeclaredError added in v0.4.3

func NewTemporaryTableRedeclaredError(table parser.Identifier) error

func NewTextField added in v0.2.6

func NewTextField(s string, sign int) textField

func NewUndefinedCursorError added in v0.4.3

func NewUndefinedCursorError(cursor parser.Identifier) error

func NewUndefinedInLineTableError added in v0.4.3

func NewUndefinedInLineTableError(table parser.Identifier) error

func NewUndefinedTemporaryTableError added in v0.4.3

func NewUndefinedTemporaryTableError(table parser.Identifier) error

func NewUndefinedVariableError added in v0.4.0

func NewUndefinedVariableError(expr parser.Variable) error

func NewUnpermittedStatementFunctionError added in v0.4.3

func NewUnpermittedStatementFunctionError(expr parser.Expression, funcname string) error

func NewUpdateFieldNotExistError added in v0.4.3

func NewUpdateFieldNotExistError(field parser.Expression) error

func NewUpdateValueAmbiguousError added in v0.4.3

func NewUpdateValueAmbiguousError(field parser.Expression, value parser.Expression) error

func NewUserTriggeredError added in v0.5.0

func NewUserTriggeredError(expr parser.Trigger, message string) error

func NewVariableRedeclaredError added in v0.4.3

func NewVariableRedeclaredError(expr parser.Variable) error

func NewWriteFileError added in v0.4.9

func NewWriteFileError(expr parser.ProcExpr, message string) error

func NotEqualTo

func NotEqualTo(p1 parser.Primary, p2 parser.Primary) ternary.Value

func Now

func Now(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Nullif

func Nullif(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Oct

func Oct(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func OctToDec

func OctToDec(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func OuterJoin

func OuterJoin(view *View, joinView *View, condition parser.Expression, direction int, parentFilter Filter) error

func ParseJoinCondition

func ParseJoinCondition(join parser.Join, view *View, joinView *View) parser.Expression

func Pow

func Pow(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Print added in v0.1.6

func Print(expr parser.Print, filter Filter) (string, error)

func Printf added in v0.4.0

func Printf(expr parser.Printf, filter Filter) (string, error)

func Rand

func Rand(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func ReadLog added in v0.4.0

func ReadLog() string

func ReadSelectLog added in v0.4.4

func ReadSelectLog() string

func Replace

func Replace(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Round

func Round(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Rpad

func Rpad(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Rtrim

func Rtrim(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Second

func Second(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func SetFlag added in v0.1.6

func SetFlag(expr parser.SetFlag) error

func Sha1

func Sha1(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Sha1Hmac

func Sha1Hmac(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Sha256

func Sha256(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Sha256Hmac

func Sha256Hmac(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Sha512

func Sha512(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Sha512Hmac

func Sha512Hmac(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Sin

func Sin(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Source added in v0.4.0

func Source(expr parser.Source, filter Filter) ([]parser.Statement, error)

func Sqrt

func Sqrt(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func String

func String(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Substr

func Substr(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Sum

func Sum(list []parser.Primary) parser.Primary

func Tan

func Tan(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Ternary

func Ternary(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func TimeDiff

func TimeDiff(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Trim

func Trim(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func UnixNanoTime

func UnixNanoTime(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func UnixTime

func UnixTime(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Upper

func Upper(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func WeekOfYear

func WeekOfYear(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Weekday

func Weekday(fn parser.Function, args []parser.Primary) (parser.Primary, error)

func Year

func Year(fn parser.Function, args []parser.Primary) (parser.Primary, error)

Types

type AggregateFunction added in v0.5.6

type AggregateFunction func([]parser.Primary) parser.Primary

type AliasMap added in v0.4.3

type AliasMap map[string]string

func (AliasMap) Add added in v0.4.3

func (m AliasMap) Add(alias parser.Identifier, path string) error

func (AliasMap) Get added in v0.4.3

func (m AliasMap) Get(alias parser.Identifier) (string, error)

type AliasMapList added in v0.4.3

type AliasMapList []AliasMap

func (AliasMapList) Add added in v0.4.5

func (list AliasMapList) Add(alias parser.Identifier, path string) error

func (AliasMapList) Get added in v0.4.3

func (list AliasMapList) Get(alias parser.Identifier) (path string, err error)

type AnalyticFunction added in v0.5.6

type AnalyticFunction interface {
	CheckArgsLen(expr parser.AnalyticFunction) error
	Execute(PartitionItemList, parser.AnalyticFunction, Filter) (map[int]parser.Primary, error)
}

type AnalyticListAgg added in v0.5.6

type AnalyticListAgg struct{}

func (AnalyticListAgg) CheckArgsLen added in v0.5.6

func (fn AnalyticListAgg) CheckArgsLen(expr parser.AnalyticFunction) error

func (AnalyticListAgg) Execute added in v0.5.6

func (fn AnalyticListAgg) Execute(items PartitionItemList, expr parser.AnalyticFunction, filter Filter) (map[int]parser.Primary, error)

type AppError added in v0.4.3

type AppError interface {
	Error() string
	ErrorMessage() string
	GetCode() int
}

type AutoCommitError added in v0.4.9

type AutoCommitError struct {
	Message string
}

func (AutoCommitError) Error added in v0.4.9

func (e AutoCommitError) Error() string

type BaseError added in v0.4.3

type BaseError struct {
	SourceFile string
	Line       int
	Char       int
	Message    string
	Code       int
}

func NewBaseError added in v0.4.3

func NewBaseError(expr parser.ProcExpr, message string) *BaseError

func NewBaseErrorWithCode added in v0.5.0

func NewBaseErrorWithCode(expr parser.ProcExpr, message string, code int) *BaseError

func (BaseError) Error added in v0.4.3

func (e BaseError) Error() string

func (BaseError) ErrorMessage added in v0.4.3

func (e BaseError) ErrorMessage() string

func (BaseError) GetCode added in v0.5.0

func (e BaseError) GetCode() int

type BuiltInFunctionDeclaredError added in v0.4.3

type BuiltInFunctionDeclaredError struct {
	*BaseError
}

type Cell

type Cell []parser.Primary

func NewCell

func NewCell(value parser.Primary) Cell

func NewGroupCell

func NewGroupCell(values []parser.Primary) Cell

func (Cell) GroupedPrimary

func (cell Cell) GroupedPrimary(index int) parser.Primary

func (Cell) Len

func (cell Cell) Len() int

func (Cell) Primary

func (cell Cell) Primary() parser.Primary

type CombinedSetFieldLengthError added in v0.4.3

type CombinedSetFieldLengthError struct {
	*BaseError
}

type ComparisonResult

type ComparisonResult int
const (
	EQUAL ComparisonResult = iota
	NOT_EQUAL
	LESS
	GREATER
	INCOMMENSURABLE
)

func CompareCombinedly

func CompareCombinedly(p1 parser.Primary, p2 parser.Primary) ComparisonResult

func (ComparisonResult) String

func (cr ComparisonResult) String() string

type CsvParsingError added in v0.4.3

type CsvParsingError struct {
	*BaseError
}

type CumeDist added in v0.5.5

type CumeDist struct{}

func (CumeDist) CheckArgsLen added in v0.5.6

func (fn CumeDist) CheckArgsLen(expr parser.AnalyticFunction) error

func (CumeDist) Execute added in v0.5.6

func (fn CumeDist) Execute(items PartitionItemList, expr parser.AnalyticFunction, filter Filter) (map[int]parser.Primary, error)

type Cursor added in v0.1.8

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

func NewCursor added in v0.1.8

func NewCursor(query parser.SelectQuery) *Cursor

func NewPseudoCursor added in v0.4.10

func NewPseudoCursor(values []parser.Primary) *Cursor

func (*Cursor) Close added in v0.1.8

func (c *Cursor) Close(name parser.Identifier) error

func (*Cursor) Fetch added in v0.1.8

func (c *Cursor) Fetch(name parser.Identifier, position int, number int) ([]parser.Primary, error)

func (*Cursor) Open added in v0.1.8

func (c *Cursor) Open(name parser.Identifier, filter Filter) error

type CursorClosedError added in v0.4.3

type CursorClosedError struct {
	*BaseError
}

type CursorFetchLengthError added in v0.4.3

type CursorFetchLengthError struct {
	*BaseError
}

type CursorMap added in v0.1.8

type CursorMap map[string]*Cursor

func (CursorMap) AddPseudoCursor added in v0.4.10

func (m CursorMap) AddPseudoCursor(name parser.Identifier, values []parser.Primary) error

func (CursorMap) Close added in v0.1.8

func (m CursorMap) Close(name parser.Identifier) error

func (CursorMap) Count added in v0.4.10

func (m CursorMap) Count(name parser.Identifier) (int, error)

func (CursorMap) Declare added in v0.4.3

func (m CursorMap) Declare(expr parser.CursorDeclaration) error

func (CursorMap) Dispose added in v0.1.8

func (m CursorMap) Dispose(name parser.Identifier) error

func (CursorMap) Fetch added in v0.1.8

func (m CursorMap) Fetch(name parser.Identifier, position int, number int) ([]parser.Primary, error)

func (CursorMap) IsInRange added in v0.2.5

func (m CursorMap) IsInRange(name parser.Identifier) (ternary.Value, error)

func (CursorMap) IsOpen added in v0.2.5

func (m CursorMap) IsOpen(name parser.Identifier) (ternary.Value, error)

func (CursorMap) Open added in v0.1.8

func (m CursorMap) Open(name parser.Identifier, filter Filter) error

type CursorMapList added in v0.4.4

type CursorMapList []CursorMap

func (CursorMapList) AddPseudoCursor added in v0.4.10

func (list CursorMapList) AddPseudoCursor(name parser.Identifier, values []parser.Primary) error

func (CursorMapList) Close added in v0.4.4

func (list CursorMapList) Close(name parser.Identifier) error

func (CursorMapList) Count added in v0.4.10

func (list CursorMapList) Count(name parser.Identifier) (int, error)

func (CursorMapList) Declare added in v0.4.4

func (list CursorMapList) Declare(expr parser.CursorDeclaration) error

func (CursorMapList) Dispose added in v0.4.4

func (list CursorMapList) Dispose(name parser.Identifier) error

func (CursorMapList) Fetch added in v0.4.4

func (list CursorMapList) Fetch(name parser.Identifier, position int, number int) ([]parser.Primary, error)

func (CursorMapList) IsInRange added in v0.4.4

func (list CursorMapList) IsInRange(name parser.Identifier) (ternary.Value, error)

func (CursorMapList) IsOpen added in v0.4.4

func (list CursorMapList) IsOpen(name parser.Identifier) (ternary.Value, error)

func (CursorMapList) Open added in v0.4.4

func (list CursorMapList) Open(name parser.Identifier, filter Filter) error

type CursorOpenError added in v0.4.3

type CursorOpenError struct {
	*BaseError
}

type CursorRedeclaredError added in v0.4.3

type CursorRedeclaredError struct {
	*BaseError
}

type DeleteTableNotSpecifiedError added in v0.4.3

type DeleteTableNotSpecifiedError struct {
	*BaseError
}

type DenseRank added in v0.2.3

type DenseRank struct{}

func (DenseRank) CheckArgsLen added in v0.5.6

func (fn DenseRank) CheckArgsLen(expr parser.AnalyticFunction) error

func (DenseRank) Execute added in v0.5.6

func (fn DenseRank) Execute(items PartitionItemList, expr parser.AnalyticFunction, filter Filter) (map[int]parser.Primary, error)

type DuplicateFieldNameError added in v0.4.3

type DuplicateFieldNameError struct {
	*BaseError
}

type DuplicateParameterError added in v0.5.0

type DuplicateParameterError struct {
	*BaseError
}

type DuplicateTableNameError added in v0.4.3

type DuplicateTableNameError struct {
	*BaseError
}

type FieldAmbiguousError added in v0.4.0

type FieldAmbiguousError struct {
	*BaseError
}

type FieldLengthNotMatchError added in v0.4.3

type FieldLengthNotMatchError struct {
	*BaseError
}

type FieldNotExistError added in v0.4.0

type FieldNotExistError struct {
	*BaseError
}

type FieldNotGroupKeyError added in v0.4.3

type FieldNotGroupKeyError struct {
	*BaseError
}

type FieldNumberNotExistError added in v0.4.6

type FieldNumberNotExistError struct {
	*BaseError
}

type FieldNumberNotGroupKeyError added in v0.4.6

type FieldNumberNotGroupKeyError struct {
	*BaseError
}

type FileAlreadyExistError added in v0.5.3

type FileAlreadyExistError struct {
	*BaseError
}

type FileInfo

type FileInfo struct {
	Path      string
	Delimiter rune
	NoHeader  bool
	Encoding  cmd.Encoding
	LineBreak cmd.LineBreak

	Temporary      bool
	InitialRecords Records
}

func NewFileInfo

func NewFileInfo(filename parser.Identifier, repository string, delimiter rune) (*FileInfo, error)

func NewFileInfoForCreate added in v0.5.3

func NewFileInfoForCreate(finename parser.Identifier, repository string, delimiter rune) (*FileInfo, error)

type FileNotExistError added in v0.4.3

type FileNotExistError struct {
	*BaseError
}

type FileUnableToReadError added in v0.4.3

type FileUnableToReadError struct {
	*BaseError
}

type Filter

type Filter struct {
	Records []FilterRecord

	VariablesList VariablesList
	TempViewsList TemporaryViewMapList
	CursorsList   CursorMapList
	FunctionsList UserDefinedFunctionsList

	InlineTablesList InlineTablesList
	AliasesList      AliasMapList

	RecursiveTable   *parser.InlineTable
	RecursiveTmpView *View
	// contains filtered or unexported fields
}

func NewEmptyFilter added in v0.4.3

func NewEmptyFilter() Filter

func NewFilter added in v0.4.0

func NewFilter(variablesList VariablesList, tempViewsList TemporaryViewMapList, cursorsList CursorMapList, functionsList UserDefinedFunctionsList) Filter

func NewFilterForRecord added in v0.2.4

func NewFilterForRecord(view *View, recordIndex int, parentFilter Filter) Filter

func NewFilterForSequentialEvaluation added in v0.4.4

func NewFilterForSequentialEvaluation(view *View, parentFilter Filter) Filter

func (Filter) CreateChildScope added in v0.4.9

func (f Filter) CreateChildScope() Filter

func (Filter) CreateNode added in v0.4.4

func (f Filter) CreateNode() Filter

func (Filter) Evaluate

func (f Filter) Evaluate(expr parser.Expression) (parser.Primary, error)

func (Filter) LoadInlineTable added in v0.4.0

func (f Filter) LoadInlineTable(clause parser.WithClause) error

func (Filter) Merge added in v0.2.4

func (f Filter) Merge(filter Filter) Filter

type FilterRecord

type FilterRecord struct {
	View        *View
	RecordIndex int
}

type FirstValue added in v0.4.9

type FirstValue struct{}

func (FirstValue) CheckArgsLen added in v0.5.6

func (fn FirstValue) CheckArgsLen(expr parser.AnalyticFunction) error

func (FirstValue) Execute added in v0.5.6

func (fn FirstValue) Execute(items PartitionItemList, expr parser.AnalyticFunction, filter Filter) (map[int]parser.Primary, error)

type FormatStringLengthNotMatchError added in v0.5.0

type FormatStringLengthNotMatchError struct {
	*BaseError
}

type FunctionArgumentLengthError added in v0.4.3

type FunctionArgumentLengthError struct {
	*BaseError
}

type FunctionInvalidArgumentError added in v0.4.3

type FunctionInvalidArgumentError struct {
	*BaseError
}

type FunctionNotExistError added in v0.4.3

type FunctionNotExistError struct {
	*BaseError
}

type FunctionRedeclaredError added in v0.4.3

type FunctionRedeclaredError struct {
	*BaseError
}
type Header []HeaderField

func AddHeaderField

func AddHeaderField(h Header, column string, alias string) (header Header, index int)

func MergeHeader

func MergeHeader(h1 Header, h2 Header) Header

func NewDualHeader

func NewDualHeader() Header

func NewEmptyHeader

func NewEmptyHeader(len int) Header

func NewHeader

func NewHeader(view string, words []string) Header

func NewHeaderWithId added in v0.5.6

func NewHeaderWithId(view string, words []string) Header

func (Header) Contains

func (h Header) Contains(fieldRef parser.FieldReference) (int, error)

func (Header) ContainsNumber added in v0.4.6

func (h Header) ContainsNumber(number parser.ColumnNumber) (int, error)

func (Header) ContainsObject added in v0.2.3

func (h Header) ContainsObject(obj parser.Expression) (int, error)

func (Header) Copy added in v0.1.6

func (h Header) Copy() Header

func (Header) Len

func (h Header) Len() int

func (Header) TableColumnNames added in v0.1.6

func (h Header) TableColumnNames() []string

func (Header) TableColumns

func (h Header) TableColumns() []parser.Expression

func (Header) Update added in v0.4.6

func (h Header) Update(reference string, fields []parser.Expression) error

type HeaderField

type HeaderField struct {
	View       string
	Column     string
	Aliases    []string
	Number     int
	FromTable  bool
	IsGroupKey bool
}

type InLineTableRedeclaredError added in v0.4.3

type InLineTableRedeclaredError struct {
	*BaseError
}

type InlineTableFieldLengthError added in v0.4.3

type InlineTableFieldLengthError struct {
	*BaseError
}

type InlineTables added in v0.3.5

type InlineTables map[string]*View

func (InlineTables) Get added in v0.3.5

func (it InlineTables) Get(name parser.Identifier) (*View, error)

func (InlineTables) Set added in v0.3.5

func (it InlineTables) Set(inlineTable parser.InlineTable, parentFilter Filter) error

type InlineTablesList added in v0.4.9

type InlineTablesList []InlineTables

func (InlineTablesList) Get added in v0.4.9

func (list InlineTablesList) Get(name parser.Identifier) (view *View, err error)

func (InlineTablesList) Load added in v0.4.9

func (list InlineTablesList) Load(clause parser.WithClause, parentFilter Filter) error

func (InlineTablesList) Set added in v0.4.9

func (list InlineTablesList) Set(inlineTable parser.InlineTable, parentFilter Filter) error

type InsertRowValueLengthError added in v0.4.3

type InsertRowValueLengthError struct {
	*BaseError
}

type InsertSelectFieldLengthError added in v0.4.3

type InsertSelectFieldLengthError struct {
	*BaseError
}

type InternalRecordIdEmptyError added in v0.4.3

type InternalRecordIdEmptyError struct {
	*BaseError
}

type InternalRecordIdNotExistError added in v0.4.3

type InternalRecordIdNotExistError struct {
	*BaseError
}

type InvalidFetchPositionError added in v0.4.3

type InvalidFetchPositionError struct {
	*BaseError
}

type InvalidFlagNameError added in v0.4.3

type InvalidFlagNameError struct {
	*BaseError
}

type InvalidFlagValueError added in v0.4.3

type InvalidFlagValueError struct {
	*BaseError
}

type InvalidLimitNumberError added in v0.4.3

type InvalidLimitNumberError struct {
	*BaseError
}

type InvalidLimitPercentageError added in v0.4.3

type InvalidLimitPercentageError struct {
	*BaseError
}

type InvalidOffsetNumberError added in v0.4.3

type InvalidOffsetNumberError struct {
	*BaseError
}

type Lag added in v0.5.6

type Lag struct{}

func (Lag) CheckArgsLen added in v0.5.6

func (fn Lag) CheckArgsLen(expr parser.AnalyticFunction) error

func (Lag) Execute added in v0.5.6

func (fn Lag) Execute(items PartitionItemList, expr parser.AnalyticFunction, filter Filter) (map[int]parser.Primary, error)

type LastValue added in v0.4.9

type LastValue struct{}

func (LastValue) CheckArgsLen added in v0.5.6

func (fn LastValue) CheckArgsLen(expr parser.AnalyticFunction) error

func (LastValue) Execute added in v0.5.6

func (fn LastValue) Execute(items PartitionItemList, expr parser.AnalyticFunction, filter Filter) (map[int]parser.Primary, error)

type Lead added in v0.5.6

type Lead struct{}

func (Lead) CheckArgsLen added in v0.5.6

func (fn Lead) CheckArgsLen(expr parser.AnalyticFunction) error

func (Lead) Execute added in v0.5.6

func (fn Lead) Execute(items PartitionItemList, expr parser.AnalyticFunction, filter Filter) (map[int]parser.Primary, error)

type NTile added in v0.5.6

type NTile struct{}

func (NTile) CheckArgsLen added in v0.5.6

func (fn NTile) CheckArgsLen(expr parser.AnalyticFunction) error

func (NTile) Execute added in v0.5.6

func (fn NTile) Execute(items PartitionItemList, expr parser.AnalyticFunction, filter Filter) (map[int]parser.Primary, error)

type NestedAggregateFunctionsError added in v0.4.3

type NestedAggregateFunctionsError struct {
	*BaseError
}

type NotGroupingRecordsError added in v0.4.3

type NotGroupingRecordsError struct {
	*BaseError
}

type NthValue added in v0.5.6

type NthValue struct{}

func (NthValue) CheckArgsLen added in v0.5.6

func (fn NthValue) CheckArgsLen(expr parser.AnalyticFunction) error

func (NthValue) Execute added in v0.5.6

func (fn NthValue) Execute(items PartitionItemList, expr parser.AnalyticFunction, filter Filter) (map[int]parser.Primary, error)

type OperationType added in v0.5.6

type OperationType int
const (
	INSERT OperationType = iota
	UPDATE
	DELETE
	CREATE_TABLE
	ADD_COLUMNS
	DROP_COLUMNS
	RENAME_COLUMN
)

type Partition added in v0.5.6

type Partition struct {
	PartitionValues []parser.Primary
	Items           PartitionItemList
}

func (Partition) Match added in v0.5.6

func (p Partition) Match(values []parser.Primary) bool

type PartitionItem added in v0.5.6

type PartitionItem struct {
	OrderValues []parser.Primary
	RecordIndex int
}

func (PartitionItem) IsSameRank added in v0.5.6

func (item PartitionItem) IsSameRank(partitionItem PartitionItem) bool

type PartitionItemList added in v0.5.6

type PartitionItemList []PartitionItem

func (PartitionItemList) Reverse added in v0.5.6

func (list PartitionItemList) Reverse() PartitionItemList

type PartitionList added in v0.5.6

type PartitionList []Partition

func (PartitionList) SearchIndex added in v0.5.6

func (list PartitionList) SearchIndex(partitionValues []parser.Primary) int

type PercentRank added in v0.5.5

type PercentRank struct{}

func (PercentRank) CheckArgsLen added in v0.5.6

func (fn PercentRank) CheckArgsLen(expr parser.AnalyticFunction) error

func (PercentRank) Execute added in v0.5.6

func (fn PercentRank) Execute(items PartitionItemList, expr parser.AnalyticFunction, filter Filter) (map[int]parser.Primary, error)

type PrintfReplaceValueLengthError added in v0.4.3

type PrintfReplaceValueLengthError struct {
	*BaseError
}

type Procedure added in v0.4.0

type Procedure struct {
	Filter    Filter
	ReturnVal parser.Primary
}

func NewProcedure added in v0.4.0

func NewProcedure() *Procedure

func (*Procedure) Commit added in v0.4.0

func (proc *Procedure) Commit(expr parser.ProcExpr) error

func (*Procedure) Execute added in v0.4.0

func (proc *Procedure) Execute(statements []parser.Statement) (StatementFlow, error)

func (*Procedure) ExecuteChild added in v0.4.0

func (proc *Procedure) ExecuteChild(statements []parser.Statement) (StatementFlow, error)

func (*Procedure) ExecuteStatement added in v0.4.0

func (proc *Procedure) ExecuteStatement(stmt parser.Statement) (StatementFlow, error)

func (*Procedure) IfStmt added in v0.4.0

func (proc *Procedure) IfStmt(stmt parser.If) (StatementFlow, error)

func (*Procedure) NewChildProcedure added in v0.4.0

func (proc *Procedure) NewChildProcedure() *Procedure

func (*Procedure) Rollback added in v0.4.0

func (proc *Procedure) Rollback()

func (*Procedure) While added in v0.4.0

func (proc *Procedure) While(stmt parser.While) (StatementFlow, error)

func (*Procedure) WhileInCursor added in v0.4.0

func (proc *Procedure) WhileInCursor(stmt parser.WhileInCursor) (StatementFlow, error)

type PseudoCursorError added in v0.4.10

type PseudoCursorError struct {
	*BaseError
}

type Rank added in v0.2.3

type Rank struct{}

func (Rank) CheckArgsLen added in v0.5.6

func (fn Rank) CheckArgsLen(expr parser.AnalyticFunction) error

func (Rank) Execute added in v0.5.6

func (fn Rank) Execute(items PartitionItemList, expr parser.AnalyticFunction, filter Filter) (map[int]parser.Primary, error)

type ReadFileError added in v0.4.9

type ReadFileError struct {
	*BaseError
}

type Record

type Record []Cell

func MergeRecord added in v0.6.1

func MergeRecord(r1 Record, r2 Record) Record

func NewEmptyRecord

func NewEmptyRecord(len int) Record

func NewRecord

func NewRecord(values []parser.Primary) Record

func NewRecordWithId added in v0.5.6

func NewRecordWithId(internalId int, values []parser.Primary) Record

func (Record) Copy added in v0.1.6

func (r Record) Copy() Record

func (Record) GroupLen

func (r Record) GroupLen() int

func (Record) IsEqualTo added in v0.2.1

func (r Record) IsEqualTo(record Record) bool

func (Record) Match added in v0.2.3

func (r Record) Match(record Record, indices []int) bool

type Records added in v0.2.1

type Records []Record

func (Records) Contains added in v0.2.1

func (r Records) Contains(record Record) bool

func (Records) Copy added in v0.4.5

func (r Records) Copy() Records

type Result

type Result struct {
	Type          OperationType
	FileInfo      *FileInfo
	OperatedCount int
}

type RowNumber added in v0.2.3

type RowNumber struct{}

func (RowNumber) CheckArgsLen added in v0.5.6

func (fn RowNumber) CheckArgsLen(expr parser.AnalyticFunction) error

func (RowNumber) Execute added in v0.5.6

func (fn RowNumber) Execute(items PartitionItemList, expr parser.AnalyticFunction, filter Filter) (map[int]parser.Primary, error)

type RowValueLengthInComparisonError added in v0.4.3

type RowValueLengthInComparisonError struct {
	*BaseError
}

type RowValueLengthInListError added in v0.4.3

type RowValueLengthInListError struct {
	*BaseError
	Index int
}

type RowValueLengthNotMatchError added in v0.4.3

type RowValueLengthNotMatchError struct {
	*BaseError
}

type SelectFieldLengthInComparisonError added in v0.4.3

type SelectFieldLengthInComparisonError struct {
	*BaseError
}

type SourceFileNotExistError added in v0.4.3

type SourceFileNotExistError struct {
	*BaseError
}

type SourceFileUnableToReadError added in v0.4.3

type SourceFileUnableToReadError struct {
	*BaseError
}

type SourceInvalidArgumentError added in v0.4.10

type SourceInvalidArgumentError struct {
	*BaseError
}

type StatementFlow added in v0.1.8

type StatementFlow int
const (
	TERMINATE StatementFlow = iota
	ERROR
	EXIT
	BREAK
	CONTINUE
	RETURN
)

type StdinEmptyError added in v0.4.3

type StdinEmptyError struct {
	*BaseError
}

type SubqueryTooManyFieldsError added in v0.4.3

type SubqueryTooManyFieldsError struct {
	*BaseError
}

type SubqueryTooManyRecordsError added in v0.4.3

type SubqueryTooManyRecordsError struct {
	*BaseError
}

type SyntaxError added in v0.4.3

type SyntaxError struct {
	*BaseError
}

type TableNotLoadedError added in v0.4.3

type TableNotLoadedError struct {
	*BaseError
}

type TemporaryTableFieldLengthError added in v0.4.3

type TemporaryTableFieldLengthError struct {
	*BaseError
}

type TemporaryTableRedeclaredError added in v0.4.3

type TemporaryTableRedeclaredError struct {
	*BaseError
}

type TemporaryViewMapList added in v0.4.4

type TemporaryViewMapList []ViewMap

func (TemporaryViewMapList) Dispose added in v0.4.4

func (list TemporaryViewMapList) Dispose(name parser.Identifier) error

func (TemporaryViewMapList) Exists added in v0.4.5

func (list TemporaryViewMapList) Exists(name string) bool

func (TemporaryViewMapList) Get added in v0.4.4

func (list TemporaryViewMapList) Get(name parser.Identifier) (*View, error)

func (TemporaryViewMapList) GetWithInternalId added in v0.4.4

func (list TemporaryViewMapList) GetWithInternalId(name parser.Identifier) (*View, error)

func (TemporaryViewMapList) Replace added in v0.4.4

func (list TemporaryViewMapList) Replace(view *View)

func (TemporaryViewMapList) Rollback added in v0.4.5

func (list TemporaryViewMapList) Rollback()

func (TemporaryViewMapList) Set added in v0.4.4

func (list TemporaryViewMapList) Set(view *View)

type UndefinedCursorError added in v0.4.3

type UndefinedCursorError struct {
	*BaseError
}

type UndefinedInLineTableError added in v0.4.3

type UndefinedInLineTableError struct {
	*BaseError
}

type UndefinedTemporaryTableError added in v0.4.3

type UndefinedTemporaryTableError struct {
	*BaseError
}

type UndefinedVariableError added in v0.4.0

type UndefinedVariableError struct {
	*BaseError
}

type UnpermittedStatementFunctionError added in v0.4.3

type UnpermittedStatementFunctionError struct {
	*BaseError
}

type UpdateFieldNotExistError added in v0.4.3

type UpdateFieldNotExistError struct {
	*BaseError
}

type UpdateValueAmbiguousError added in v0.4.3

type UpdateValueAmbiguousError struct {
	*BaseError
}

type UserDefinedFunction added in v0.4.3

type UserDefinedFunction struct {
	Name         parser.Identifier
	Statements   []parser.Statement
	Parameters   []parser.Variable
	Defaults     map[string]parser.Expression
	RequiredArgs int

	IsAggregate bool
	Cursor      parser.Identifier // For Aggregate Functions
}

func (*UserDefinedFunction) CheckArgsLen added in v0.5.0

func (fn *UserDefinedFunction) CheckArgsLen(expr parser.Expression, name string, argsLen int) error

func (*UserDefinedFunction) Execute added in v0.4.3

func (fn *UserDefinedFunction) Execute(args []parser.Primary, filter Filter) (parser.Primary, error)

func (*UserDefinedFunction) ExecuteAggregate added in v0.4.11

func (fn *UserDefinedFunction) ExecuteAggregate(values []parser.Primary, args []parser.Primary, filter Filter) (parser.Primary, error)

type UserDefinedFunctionMap added in v0.4.3

type UserDefinedFunctionMap map[string]*UserDefinedFunction

func (UserDefinedFunctionMap) CheckDuplicate added in v0.4.10

func (m UserDefinedFunctionMap) CheckDuplicate(name parser.Identifier) error

func (UserDefinedFunctionMap) Declare added in v0.4.3

func (UserDefinedFunctionMap) DeclareAggregate added in v0.4.10

func (m UserDefinedFunctionMap) DeclareAggregate(expr parser.AggregateDeclaration) error

func (UserDefinedFunctionMap) Get added in v0.4.3

type UserDefinedFunctionsList added in v0.4.9

type UserDefinedFunctionsList []UserDefinedFunctionMap

func (UserDefinedFunctionsList) Declare added in v0.4.9

func (UserDefinedFunctionsList) DeclareAggregate added in v0.4.10

func (list UserDefinedFunctionsList) DeclareAggregate(expr parser.AggregateDeclaration) error

func (UserDefinedFunctionsList) Get added in v0.4.9

type UserTriggeredError added in v0.5.0

type UserTriggeredError struct {
	*BaseError
}

type VariableRedeclaredError added in v0.4.3

type VariableRedeclaredError struct {
	*BaseError
}

type Variables

type Variables map[string]parser.Primary

func (Variables) Add

func (v Variables) Add(variable parser.Variable, value parser.Primary) error

func (Variables) Declare added in v0.4.0

func (v Variables) Declare(declaration parser.VariableDeclaration, filter Filter) error

func (Variables) Dispose added in v0.4.4

func (v Variables) Dispose(variable parser.Variable) error

func (Variables) Get

func (v Variables) Get(variable parser.Variable) (parser.Primary, error)

func (Variables) Set

func (v Variables) Set(variable parser.Variable, value parser.Primary) error

func (Variables) Substitute

func (v Variables) Substitute(substitution parser.VariableSubstitution, filter Filter) (parser.Primary, error)

type VariablesList added in v0.4.4

type VariablesList []Variables

func (VariablesList) Declare added in v0.4.4

func (list VariablesList) Declare(expr parser.VariableDeclaration, filter Filter) error

func (VariablesList) Dispose added in v0.4.4

func (list VariablesList) Dispose(expr parser.Variable) error

func (VariablesList) Get added in v0.4.4

func (list VariablesList) Get(expr parser.Variable) (value parser.Primary, err error)

func (VariablesList) Substitute added in v0.4.4

func (list VariablesList) Substitute(expr parser.VariableSubstitution, filter Filter) (value parser.Primary, err error)

type View

type View struct {
	Header  Header
	Records Records

	FileInfo *FileInfo

	Filter Filter

	OperatedRecords int
	OperatedFields  int

	UseInternalId bool
	// contains filtered or unexported fields
}

func AddColumns added in v0.1.6

func AddColumns(query parser.AddColumns, parentFilter Filter) (*View, error)

func CreateTable added in v0.1.6

func CreateTable(query parser.CreateTable) (*View, error)

func Delete added in v0.1.6

func Delete(query parser.DeleteQuery, parentFilter Filter) ([]*View, error)

func DropColumns added in v0.1.6

func DropColumns(query parser.DropColumns, parentFilter Filter) (*View, error)

func Insert added in v0.1.6

func Insert(query parser.InsertQuery, parentFilter Filter) (*View, error)

func NewView

func NewView() *View

func NewViewFromGroupedRecord

func NewViewFromGroupedRecord(filterRecord FilterRecord) *View

func RenameColumn added in v0.1.6

func RenameColumn(query parser.RenameColumn, parentFilter Filter) (*View, error)

func Select added in v0.1.6

func Select(query parser.SelectQuery, parentFilter Filter) (*View, error)

func Update added in v0.1.6

func Update(query parser.UpdateQuery, parentFilter Filter) ([]*View, error)

func (*View) Copy added in v0.1.6

func (view *View) Copy() *View

func (*View) Distinct added in v0.2.1

func (view *View) Distinct()

func (*View) Except added in v0.2.1

func (view *View) Except(calcView *View, all bool)

func (*View) Extract

func (view *View) Extract()

func (*View) FieldIndex added in v0.1.6

func (view *View) FieldIndex(fieldRef parser.Expression) (int, error)

func (*View) FieldIndices added in v0.1.6

func (view *View) FieldIndices(fields []parser.Expression) ([]int, error)

func (*View) FieldLen

func (view *View) FieldLen() int

func (*View) FieldViewName added in v0.1.8

func (view *View) FieldViewName(fieldRef parser.Expression) (string, error)

func (*View) Fix

func (view *View) Fix()

func (*View) GroupBy

func (view *View) GroupBy(clause parser.GroupByClause) error

func (*View) Having

func (view *View) Having(clause parser.HavingClause) error

func (*View) InsertFromQuery added in v0.1.6

func (view *View) InsertFromQuery(fields []parser.Expression, query parser.SelectQuery, filter Filter) error

func (*View) InsertValues added in v0.1.6

func (view *View) InsertValues(fields []parser.Expression, list []parser.Expression, filter Filter) error

func (*View) InternalRecordId added in v0.1.6

func (view *View) InternalRecordId(ref string, recordIndex int) (int, error)

func (*View) Intersect added in v0.2.1

func (view *View) Intersect(calcView *View, all bool)

func (*View) Len

func (view *View) Len() int

func (*View) Less

func (view *View) Less(i, j int) bool

func (*View) Limit

func (view *View) Limit(clause parser.LimitClause) error

func (*View) ListValuesForAggregateFunctions added in v0.4.9

func (view *View) ListValuesForAggregateFunctions(expr parser.Expression, arg parser.Expression, distinct bool, filter Filter) ([]parser.Primary, error)

func (*View) ListValuesForAnalyticFunctions added in v0.5.6

func (view *View) ListValuesForAnalyticFunctions(fn parser.AnalyticFunction, partitionItems PartitionItemList) ([]parser.Primary, error)

func (*View) Load added in v0.1.6

func (view *View) Load(clause parser.FromClause, filter Filter) error

func (*View) LoadFromTableIdentifier added in v0.4.8

func (view *View) LoadFromTableIdentifier(table parser.Expression, filter Filter) error

func (*View) Offset added in v0.2.2

func (view *View) Offset(clause parser.OffsetClause) error

func (*View) OrderBy

func (view *View) OrderBy(clause parser.OrderByClause) error

func (*View) RecordLen

func (view *View) RecordLen() int

func (*View) RestoreHeaderReferences added in v0.4.10

func (view *View) RestoreHeaderReferences()

func (*View) Rollback added in v0.4.5

func (view *View) Rollback()

func (*View) Select

func (view *View) Select(clause parser.SelectClause) error

func (*View) SelectAllColumns added in v0.1.6

func (view *View) SelectAllColumns() error

func (*View) Swap

func (view *View) Swap(i, j int)

func (*View) Union added in v0.2.1

func (view *View) Union(calcView *View, all bool)

func (*View) Where

func (view *View) Where(clause parser.WhereClause) error

type ViewMap added in v0.1.6

type ViewMap map[string]*View

func (ViewMap) Clear added in v0.1.6

func (m ViewMap) Clear()

func (ViewMap) DisposeTemporaryTable added in v0.4.1

func (m ViewMap) DisposeTemporaryTable(table parser.Identifier) error

func (ViewMap) Exists added in v0.1.6

func (m ViewMap) Exists(fpath string) bool

func (ViewMap) Get added in v0.1.6

func (m ViewMap) Get(fpath parser.Identifier) (*View, error)

func (ViewMap) GetWithInternalId added in v0.1.6

func (m ViewMap) GetWithInternalId(fpath parser.Identifier) (*View, error)

func (ViewMap) Replace added in v0.2.0

func (m ViewMap) Replace(view *View) error

func (ViewMap) Set added in v0.1.6

func (m ViewMap) Set(view *View)

type WriteFileError added in v0.4.9

type WriteFileError struct {
	*BaseError
}

Jump to

Keyboard shortcuts

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