id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
20,500
araddon/qlbridge
lex/lexer.go
IsEnd
func (l *Lexer) IsEnd() bool { //u.Infof("isEnd? %v:%v", l.pos, len(l.input)) if l.pos >= len(l.input) { return true } // if l.Peek() == ';' { // return true // } return false }
go
func (l *Lexer) IsEnd() bool { //u.Infof("isEnd? %v:%v", l.pos, len(l.input)) if l.pos >= len(l.input) { return true } // if l.Peek() == ';' { // return true // } return false }
[ "func", "(", "l", "*", "Lexer", ")", "IsEnd", "(", ")", "bool", "{", "//u.Infof(\"isEnd? %v:%v\", l.pos, len(l.input))", "if", "l", ".", "pos", ">=", "len", "(", "l", ".", "input", ")", "{", "return", "true", "\n", "}", "\n", "// if l.Peek() == ';' {", "//...
// IsEnd have we consumed all input?
[ "IsEnd", "have", "we", "consumed", "all", "input?" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L368-L377
20,501
araddon/qlbridge
lex/lexer.go
IsComment
func (l *Lexer) IsComment() bool { r := l.Peek() switch r { case '#': return true case '/', '-': // continue on, might be, check 2nd character cv := l.PeekX(2) switch cv { case "//": return true case "--": return true } default: return false } return false }
go
func (l *Lexer) IsComment() bool { r := l.Peek() switch r { case '#': return true case '/', '-': // continue on, might be, check 2nd character cv := l.PeekX(2) switch cv { case "//": return true case "--": return true } default: return false } return false }
[ "func", "(", "l", "*", "Lexer", ")", "IsComment", "(", ")", "bool", "{", "r", ":=", "l", ".", "Peek", "(", ")", "\n", "switch", "r", "{", "case", "'#'", ":", "return", "true", "\n", "case", "'/'", ",", "'-'", ":", "// continue on, might be, check 2nd...
// IsComment Is this a comment?
[ "IsComment", "Is", "this", "a", "comment?" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L380-L398
20,502
araddon/qlbridge
lex/lexer.go
Emit
func (l *Lexer) Emit(t TokenType) { debugf("emit: %s '%s' stack=%v start=%d pos=%d", t, l.input[l.start:l.pos], len(l.stack), l.start, l.pos) // We are going to use 1 based indexing (not 0 based) for lines // because humans don't think that way if l.lastQuoteMark != 0 { l.lastToken = Token{T: t, V: l.input[l.st...
go
func (l *Lexer) Emit(t TokenType) { debugf("emit: %s '%s' stack=%v start=%d pos=%d", t, l.input[l.start:l.pos], len(l.stack), l.start, l.pos) // We are going to use 1 based indexing (not 0 based) for lines // because humans don't think that way if l.lastQuoteMark != 0 { l.lastToken = Token{T: t, V: l.input[l.st...
[ "func", "(", "l", "*", "Lexer", ")", "Emit", "(", "t", "TokenType", ")", "{", "debugf", "(", "\"", "\"", ",", "t", ",", "l", ".", "input", "[", "l", ".", "start", ":", "l", ".", "pos", "]", ",", "len", "(", "l", ".", "stack", ")", ",", "l...
// Emit passes an token back to the client.
[ "Emit", "passes", "an", "token", "back", "to", "the", "client", "." ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L401-L413
20,503
araddon/qlbridge
lex/lexer.go
ignoreWord
func (l *Lexer) ignoreWord(word string) { l.pos += len(word) l.start = l.pos }
go
func (l *Lexer) ignoreWord(word string) { l.pos += len(word) l.start = l.pos }
[ "func", "(", "l", "*", "Lexer", ")", "ignoreWord", "(", "word", "string", ")", "{", "l", ".", "pos", "+=", "len", "(", "word", ")", "\n", "l", ".", "start", "=", "l", ".", "pos", "\n", "}" ]
// ignore skips over the item
[ "ignore", "skips", "over", "the", "item" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L421-L424
20,504
araddon/qlbridge
lex/lexer.go
current
func (l *Lexer) current() string { if l.pos <= l.start { return "" } str := l.input[l.start:l.pos] l.start = l.pos return str }
go
func (l *Lexer) current() string { if l.pos <= l.start { return "" } str := l.input[l.start:l.pos] l.start = l.pos return str }
[ "func", "(", "l", "*", "Lexer", ")", "current", "(", ")", "string", "{", "if", "l", ".", "pos", "<=", "l", ".", "start", "{", "return", "\"", "\"", "\n", "}", "\n", "str", ":=", "l", ".", "input", "[", "l", ".", "start", ":", "l", ".", "pos...
// Returns current string not yet emitted
[ "Returns", "current", "string", "not", "yet", "emitted" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L445-L452
20,505
araddon/qlbridge
lex/lexer.go
SkipWhiteSpaces
func (l *Lexer) SkipWhiteSpaces() { for rune := l.Next(); unicode.IsSpace(rune); rune = l.Next() { if rune == '\n' { // New line, lets keep track of line position l.line++ l.linepos = l.pos } } l.backup() l.ignore() }
go
func (l *Lexer) SkipWhiteSpaces() { for rune := l.Next(); unicode.IsSpace(rune); rune = l.Next() { if rune == '\n' { // New line, lets keep track of line position l.line++ l.linepos = l.pos } } l.backup() l.ignore() }
[ "func", "(", "l", "*", "Lexer", ")", "SkipWhiteSpaces", "(", ")", "{", "for", "rune", ":=", "l", ".", "Next", "(", ")", ";", "unicode", ".", "IsSpace", "(", "rune", ")", ";", "rune", "=", "l", ".", "Next", "(", ")", "{", "if", "rune", "==", "...
// SkipWhiteSpaces Skips white space characters in the input.
[ "SkipWhiteSpaces", "Skips", "white", "space", "characters", "in", "the", "input", "." ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L491-L501
20,506
araddon/qlbridge
lex/lexer.go
SkipWhiteSpacesNewLine
func (l *Lexer) SkipWhiteSpacesNewLine() bool { rune := l.Next() hasNewLine := false for { if rune == '\n' { hasNewLine = true // New line, lets keep track of line position l.line++ l.linepos = 0 } else if !unicode.IsSpace(rune) { break } rune = l.Next() } l.backup() l.ignore() return hasN...
go
func (l *Lexer) SkipWhiteSpacesNewLine() bool { rune := l.Next() hasNewLine := false for { if rune == '\n' { hasNewLine = true // New line, lets keep track of line position l.line++ l.linepos = 0 } else if !unicode.IsSpace(rune) { break } rune = l.Next() } l.backup() l.ignore() return hasN...
[ "func", "(", "l", "*", "Lexer", ")", "SkipWhiteSpacesNewLine", "(", ")", "bool", "{", "rune", ":=", "l", ".", "Next", "(", ")", "\n", "hasNewLine", ":=", "false", "\n", "for", "{", "if", "rune", "==", "'\\n'", "{", "hasNewLine", "=", "true", "\n", ...
// SkipWhiteSpacesNewLine Skips white space characters in the input, returns bool // for if it contained new line
[ "SkipWhiteSpacesNewLine", "Skips", "white", "space", "characters", "in", "the", "input", "returns", "bool", "for", "if", "it", "contained", "new", "line" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L505-L522
20,507
araddon/qlbridge
lex/lexer.go
ReverseTrim
func (l *Lexer) ReverseTrim() { for i := len(l.input) - 1; i >= 0; i-- { if !unicode.IsSpace(rune(l.input[i])) { if i < (len(l.input) - 1) { //u.Warnf("trim: '%v'", l.input[:i+1]) l.input = l.input[:i+1] } break } } }
go
func (l *Lexer) ReverseTrim() { for i := len(l.input) - 1; i >= 0; i-- { if !unicode.IsSpace(rune(l.input[i])) { if i < (len(l.input) - 1) { //u.Warnf("trim: '%v'", l.input[:i+1]) l.input = l.input[:i+1] } break } } }
[ "func", "(", "l", "*", "Lexer", ")", "ReverseTrim", "(", ")", "{", "for", "i", ":=", "len", "(", "l", ".", "input", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", "{", "if", "!", "unicode", ".", "IsSpace", "(", "rune", "(", "l", ".", ...
// Skips white space characters at end by trimming so we can recognize the end // more easily
[ "Skips", "white", "space", "characters", "at", "end", "by", "trimming", "so", "we", "can", "recognize", "the", "end", "more", "easily" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L526-L536
20,508
araddon/qlbridge
lex/lexer.go
match
func (l *Lexer) match(matchTo string, skip int) bool { //u.Debugf("match(%q) peek:%q ", matchTo, l.PeekWord()) for _, matchRune := range matchTo { //u.Debugf("match rune? %v", string(matchRune)) if skip > 0 { skip-- continue } nr := l.Next() //u.Debugf("rune=%s n=%s %v %v", string(matchRune), st...
go
func (l *Lexer) match(matchTo string, skip int) bool { //u.Debugf("match(%q) peek:%q ", matchTo, l.PeekWord()) for _, matchRune := range matchTo { //u.Debugf("match rune? %v", string(matchRune)) if skip > 0 { skip-- continue } nr := l.Next() //u.Debugf("rune=%s n=%s %v %v", string(matchRune), st...
[ "func", "(", "l", "*", "Lexer", ")", "match", "(", "matchTo", "string", ",", "skip", "int", ")", "bool", "{", "//u.Debugf(\"match(%q) peek:%q \", matchTo, l.PeekWord())", "for", "_", ",", "matchRune", ":=", "range", "matchTo", "{", "//u.Debugf(\"match rune? %v\", s...
// Scans input and matches against the string. // Returns true if the expected string was matched. // expects matchTo to be a lower case string
[ "Scans", "input", "and", "matches", "against", "the", "string", ".", "Returns", "true", "if", "the", "expected", "string", "was", "matched", ".", "expects", "matchTo", "to", "be", "a", "lower", "case", "string" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L541-L568
20,509
araddon/qlbridge
lex/lexer.go
errorToken
func (l *Lexer) errorToken(format string, args ...interface{}) StateFn { //fmt.Sprintf(format, args...) l.Emit(TokenError) return nil }
go
func (l *Lexer) errorToken(format string, args ...interface{}) StateFn { //fmt.Sprintf(format, args...) l.Emit(TokenError) return nil }
[ "func", "(", "l", "*", "Lexer", ")", "errorToken", "(", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "StateFn", "{", "//fmt.Sprintf(format, args...)", "l", ".", "Emit", "(", "TokenError", ")", "\n", "return", "nil", "\n", "}" ]
// Emits an error token and terminates the scan // by passing back a nil ponter that will be the next state // terminating lexer.next function
[ "Emits", "an", "error", "token", "and", "terminates", "the", "scan", "by", "passing", "back", "a", "nil", "ponter", "that", "will", "be", "the", "next", "state", "terminating", "lexer", ".", "next", "function" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L596-L600
20,510
araddon/qlbridge
lex/lexer.go
isNextKeyword
func (l *Lexer) isNextKeyword(peekWord string) bool { if len(peekWord) == 0 { return false } kwMaybe := strings.ToLower(peekWord) //u.Debugf("isNextKeyword? '%s' len:%v", kwMaybe, len(l.statement.Clauses)) clause := l.curClause.next if clause == nil { clause = l.curClause.parent } //u.Infof("clause: %s...
go
func (l *Lexer) isNextKeyword(peekWord string) bool { if len(peekWord) == 0 { return false } kwMaybe := strings.ToLower(peekWord) //u.Debugf("isNextKeyword? '%s' len:%v", kwMaybe, len(l.statement.Clauses)) clause := l.curClause.next if clause == nil { clause = l.curClause.parent } //u.Infof("clause: %s...
[ "func", "(", "l", "*", "Lexer", ")", "isNextKeyword", "(", "peekWord", "string", ")", "bool", "{", "if", "len", "(", "peekWord", ")", "==", "0", "{", "return", "false", "\n", "}", "\n", "kwMaybe", ":=", "strings", ".", "ToLower", "(", "peekWord", ")"...
// non-consuming check to see if we are about to find next keyword
[ "non", "-", "consuming", "check", "to", "see", "if", "we", "are", "about", "to", "find", "next", "keyword" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L646-L685
20,511
araddon/qlbridge
lex/lexer.go
isIdentity
func (l *Lexer) isIdentity() bool { // Identity are strings not values r := l.Peek() switch { case r == '[': // This character [ is a little special // as it is going to look to see if the 2nd character is // valid identity character so ie alpha/numeric peek2 := l.PeekX(2) if len(peek2) == 2 { return i...
go
func (l *Lexer) isIdentity() bool { // Identity are strings not values r := l.Peek() switch { case r == '[': // This character [ is a little special // as it is going to look to see if the 2nd character is // valid identity character so ie alpha/numeric peek2 := l.PeekX(2) if len(peek2) == 2 { return i...
[ "func", "(", "l", "*", "Lexer", ")", "isIdentity", "(", ")", "bool", "{", "// Identity are strings not values", "r", ":=", "l", ".", "Peek", "(", ")", "\n", "switch", "{", "case", "r", "==", "'['", ":", "// This character [ is a little special", "// as it is g...
// non-consuming isIdentity // Identities are non-numeric string values that are not quoted
[ "non", "-", "consuming", "isIdentity", "Identities", "are", "non", "-", "numeric", "string", "values", "that", "are", "not", "quoted" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L689-L712
20,512
araddon/qlbridge
lex/lexer.go
clauseState
func (l *Lexer) clauseState() StateFn { if l.curClause != nil { if len(l.curClause.Clauses) > 0 { return l.curClause.Clauses[0].Lexer } return l.curClause.Lexer } return emptyLexFn }
go
func (l *Lexer) clauseState() StateFn { if l.curClause != nil { if len(l.curClause.Clauses) > 0 { return l.curClause.Clauses[0].Lexer } return l.curClause.Lexer } return emptyLexFn }
[ "func", "(", "l", "*", "Lexer", ")", "clauseState", "(", ")", "StateFn", "{", "if", "l", ".", "curClause", "!=", "nil", "{", "if", "len", "(", "l", ".", "curClause", ".", "Clauses", ")", ">", "0", "{", "return", "l", ".", "curClause", ".", "Claus...
// current clause state function, used for repeated clauses
[ "current", "clause", "state", "function", "used", "for", "repeated", "clauses" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L747-L755
20,513
araddon/qlbridge
lex/lexer.go
LexMatchClosure
func LexMatchClosure(tok TokenType, nextFn StateFn) StateFn { return func(l *Lexer) StateFn { //u.Debugf("%p lexMatch t=%s peek=%s", l, tok, l.PeekWord()) if l.match(tok.String(), 0) { //u.Debugf("found match: %s %v", tok, nextFn) l.Emit(tok) return nextFn } u.Warnf("unexpected token: %v peek:%s...
go
func LexMatchClosure(tok TokenType, nextFn StateFn) StateFn { return func(l *Lexer) StateFn { //u.Debugf("%p lexMatch t=%s peek=%s", l, tok, l.PeekWord()) if l.match(tok.String(), 0) { //u.Debugf("found match: %s %v", tok, nextFn) l.Emit(tok) return nextFn } u.Warnf("unexpected token: %v peek:%s...
[ "func", "LexMatchClosure", "(", "tok", "TokenType", ",", "nextFn", "StateFn", ")", "StateFn", "{", "return", "func", "(", "l", "*", "Lexer", ")", "StateFn", "{", "//u.Debugf(\"%p lexMatch t=%s peek=%s\", l, tok, l.PeekWord())", "if", "l", ".", "match", "(", "tok...
// LexMatchClosure matches expected tokentype emitting the token on success // and returning passed state function.
[ "LexMatchClosure", "matches", "expected", "tokentype", "emitting", "the", "token", "on", "success", "and", "returning", "passed", "state", "function", "." ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L761-L772
20,514
araddon/qlbridge
lex/lexer.go
LexIdentityOrValue
func LexIdentityOrValue(l *Lexer) StateFn { l.SkipWhiteSpaces() r := l.Peek() if r == '(' { return nil } //u.Debugf("LexIdentityOrValue identity?%v expr?%v %v peek5='%v'", l.isIdentity(), l.isExpr(), string(l.Peek()), string(l.PeekX(5))) // Expressions end in Parens: LOWER(item) if l.isExpr() { return ...
go
func LexIdentityOrValue(l *Lexer) StateFn { l.SkipWhiteSpaces() r := l.Peek() if r == '(' { return nil } //u.Debugf("LexIdentityOrValue identity?%v expr?%v %v peek5='%v'", l.isIdentity(), l.isExpr(), string(l.Peek()), string(l.PeekX(5))) // Expressions end in Parens: LOWER(item) if l.isExpr() { return ...
[ "func", "LexIdentityOrValue", "(", "l", "*", "Lexer", ")", "StateFn", "{", "l", ".", "SkipWhiteSpaces", "(", ")", "\n\n", "r", ":=", "l", ".", "Peek", "(", ")", "\n", "if", "r", "==", "'('", "{", "return", "nil", "\n", "}", "\n", "//u.Debugf(\"LexIde...
// look for either an Identity or Value //
[ "look", "for", "either", "an", "Identity", "or", "Value" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L1182-L1203
20,515
araddon/qlbridge
lex/lexer.go
LexEndOfStatement
func LexEndOfStatement(l *Lexer) StateFn { l.SkipWhiteSpaces() r := l.Next() if r == ';' { l.Emit(TokenEOS) return nil } l.SkipWhiteSpaces() if l.IsEnd() { return nil } //u.Warnf("END: %s %s", string(r), l.PeekX(20)) return l.errorToken("Unexpected token:" + l.current()) }
go
func LexEndOfStatement(l *Lexer) StateFn { l.SkipWhiteSpaces() r := l.Next() if r == ';' { l.Emit(TokenEOS) return nil } l.SkipWhiteSpaces() if l.IsEnd() { return nil } //u.Warnf("END: %s %s", string(r), l.PeekX(20)) return l.errorToken("Unexpected token:" + l.current()) }
[ "func", "LexEndOfStatement", "(", "l", "*", "Lexer", ")", "StateFn", "{", "l", ".", "SkipWhiteSpaces", "(", ")", "\n", "r", ":=", "l", ".", "Next", "(", ")", "\n", "if", "r", "==", "';'", "{", "l", ".", "Emit", "(", "TokenEOS", ")", "\n", "return...
// LexEndOfStatement Look for end of statement defined by either a semicolon or end of file
[ "LexEndOfStatement", "Look", "for", "end", "of", "statement", "defined", "by", "either", "a", "semicolon", "or", "end", "of", "file" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L1564-L1577
20,516
araddon/qlbridge
lex/lexer.go
LexSelectClause
func LexSelectClause(l *Lexer) StateFn { l.SkipWhiteSpaces() if l.IsEnd() { return nil } if l.Peek() == ')' { return nil } word := strings.ToLower(l.PeekWord()) //u.Debugf("LexSelectClause '%v'", word) switch word { case "from", "where", "limit", "group", "having": return nil case "all": //ALL? l....
go
func LexSelectClause(l *Lexer) StateFn { l.SkipWhiteSpaces() if l.IsEnd() { return nil } if l.Peek() == ')' { return nil } word := strings.ToLower(l.PeekWord()) //u.Debugf("LexSelectClause '%v'", word) switch word { case "from", "where", "limit", "group", "having": return nil case "all": //ALL? l....
[ "func", "LexSelectClause", "(", "l", "*", "Lexer", ")", "StateFn", "{", "l", ".", "SkipWhiteSpaces", "(", ")", "\n", "if", "l", ".", "IsEnd", "(", ")", "{", "return", "nil", "\n", "}", "\n", "if", "l", ".", "Peek", "(", ")", "==", "')'", "{", "...
// LexSelectClause Handle start of select statements, specifically looking for // @@variables, *, or else we drop into <select_list> // // <SELECT> :== // (DISTINCT|ALL)? ( <sql_variable> | * | <select_list> ) [FROM <source_clause>] // // <sql_variable> = @@stuff //
[ "LexSelectClause", "Handle", "start", "of", "select", "statements", "specifically", "looking", "for" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L1587-L1654
20,517
araddon/qlbridge
lex/lexer.go
LexUpsertClause
func LexUpsertClause(l *Lexer) StateFn { l.SkipWhiteSpaces() if l.IsEnd() { return nil } word := strings.ToLower(l.PeekWord()) //u.Debugf("LexUpsertClause '%v' %v", word, l.PeekX(10)) switch word { case "insert": l.ConsumeWord(word) l.Emit(TokenInsert) return LexUpsertClause case "upsert": l.Cons...
go
func LexUpsertClause(l *Lexer) StateFn { l.SkipWhiteSpaces() if l.IsEnd() { return nil } word := strings.ToLower(l.PeekWord()) //u.Debugf("LexUpsertClause '%v' %v", word, l.PeekX(10)) switch word { case "insert": l.ConsumeWord(word) l.Emit(TokenInsert) return LexUpsertClause case "upsert": l.Cons...
[ "func", "LexUpsertClause", "(", "l", "*", "Lexer", ")", "StateFn", "{", "l", ".", "SkipWhiteSpaces", "(", ")", "\n", "if", "l", ".", "IsEnd", "(", ")", "{", "return", "nil", "\n", "}", "\n", "word", ":=", "strings", ".", "ToLower", "(", "l", ".", ...
// Handle start of insert, Upsert statements //
[ "Handle", "start", "of", "insert", "Upsert", "statements" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L1658-L1688
20,518
araddon/qlbridge
lex/lexer.go
LexSubQuery
func LexSubQuery(l *Lexer) StateFn { //u.Debugf("LexSubQuery '%v'", l.PeekX(10)) l.SkipWhiteSpaces() r := l.Peek() if l.IsEnd() { return nil } if r == ')' { l.Next() l.Emit(TokenRightParenthesis) return nil } /* TODO: this is a hack because the LexDialect from above should be recursive, ie su...
go
func LexSubQuery(l *Lexer) StateFn { //u.Debugf("LexSubQuery '%v'", l.PeekX(10)) l.SkipWhiteSpaces() r := l.Peek() if l.IsEnd() { return nil } if r == ')' { l.Next() l.Emit(TokenRightParenthesis) return nil } /* TODO: this is a hack because the LexDialect from above should be recursive, ie su...
[ "func", "LexSubQuery", "(", "l", "*", "Lexer", ")", "StateFn", "{", "//u.Debugf(\"LexSubQuery '%v'\", l.PeekX(10))", "l", ".", "SkipWhiteSpaces", "(", ")", "\n", "r", ":=", "l", ".", "Peek", "(", ")", "\n", "if", "l", ".", "IsEnd", "(", ")", "{", "retur...
// Handle recursive subqueries //
[ "Handle", "recursive", "subqueries" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L1692-L1733
20,519
araddon/qlbridge
lex/lexer.go
LexJson
func LexJson(l *Lexer) StateFn { l.SkipWhiteSpaces() if l.IsEnd() { return nil } r := l.Peek() //u.Debugf("LexJson '%v' %v", string(r), l.PeekX(10)) switch r { case '{', '[': return LexJsonValue } //u.Warnf("Did not find json? %v", l.PeekX(20)) return nil }
go
func LexJson(l *Lexer) StateFn { l.SkipWhiteSpaces() if l.IsEnd() { return nil } r := l.Peek() //u.Debugf("LexJson '%v' %v", string(r), l.PeekX(10)) switch r { case '{', '[': return LexJsonValue } //u.Warnf("Did not find json? %v", l.PeekX(20)) return nil }
[ "func", "LexJson", "(", "l", "*", "Lexer", ")", "StateFn", "{", "l", ".", "SkipWhiteSpaces", "(", ")", "\n", "if", "l", ".", "IsEnd", "(", ")", "{", "return", "nil", "\n", "}", "\n", "r", ":=", "l", ".", "Peek", "(", ")", "\n", "//u.Debugf(\"LexJ...
// Lex Valid Json // // Must start with { or [ //
[ "Lex", "Valid", "Json", "Must", "start", "with", "{", "or", "[" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L2730-L2744
20,520
araddon/qlbridge
lex/lexer.go
LexJsonArray
func LexJsonArray(l *Lexer) StateFn { l.SkipWhiteSpaces() if l.IsEnd() { return nil } r := l.Peek() //u.Debugf("LexJsonArray '%v' peek:%v", string(r), l.PeekX(10)) switch r { case ']': l.Next() l.Emit(TokenRightBracket) return nil case ',': l.Next() // consume , l.Emit(TokenComma) return LexJson...
go
func LexJsonArray(l *Lexer) StateFn { l.SkipWhiteSpaces() if l.IsEnd() { return nil } r := l.Peek() //u.Debugf("LexJsonArray '%v' peek:%v", string(r), l.PeekX(10)) switch r { case ']': l.Next() l.Emit(TokenRightBracket) return nil case ',': l.Next() // consume , l.Emit(TokenComma) return LexJson...
[ "func", "LexJsonArray", "(", "l", "*", "Lexer", ")", "StateFn", "{", "l", ".", "SkipWhiteSpaces", "(", ")", "\n", "if", "l", ".", "IsEnd", "(", ")", "{", "return", "nil", "\n", "}", "\n", "r", ":=", "l", ".", "Peek", "(", ")", "\n", "//u.Debugf(\...
// Lex Valid Json Array // // Must End with ] //
[ "Lex", "Valid", "Json", "Array", "Must", "End", "with", "]" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L2789-L2823
20,521
araddon/qlbridge
lex/lexer.go
LexJsonObject
func LexJsonObject(l *Lexer) StateFn { l.SkipWhiteSpaces() if l.IsEnd() { return nil } r := l.Peek() //u.Debugf("LexJsonObject '%v' %v", string(r), l.PeekX(10)) switch r { case '}': l.Next() l.Emit(TokenRightBrace) return nil case ':': l.Next() // consume : l.Emit(TokenColon) l.Push("LexJsonObj...
go
func LexJsonObject(l *Lexer) StateFn { l.SkipWhiteSpaces() if l.IsEnd() { return nil } r := l.Peek() //u.Debugf("LexJsonObject '%v' %v", string(r), l.PeekX(10)) switch r { case '}': l.Next() l.Emit(TokenRightBrace) return nil case ':': l.Next() // consume : l.Emit(TokenColon) l.Push("LexJsonObj...
[ "func", "LexJsonObject", "(", "l", "*", "Lexer", ")", "StateFn", "{", "l", ".", "SkipWhiteSpaces", "(", ")", "\n", "if", "l", ".", "IsEnd", "(", ")", "{", "return", "nil", "\n", "}", "\n", "r", ":=", "l", ".", "Peek", "(", ")", "\n", "//u.Debugf(...
// Lex Valid Json Object // // Must End with } //
[ "Lex", "Valid", "Json", "Object", "Must", "End", "with", "}" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L2829-L2867
20,522
araddon/qlbridge
lex/lexer.go
isAlNumOrPeriod
func isAlNumOrPeriod(r rune) bool { return r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r) || r == '.' }
go
func isAlNumOrPeriod(r rune) bool { return r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r) || r == '.' }
[ "func", "isAlNumOrPeriod", "(", "r", "rune", ")", "bool", "{", "return", "r", "==", "'_'", "||", "unicode", ".", "IsLetter", "(", "r", ")", "||", "unicode", ".", "IsDigit", "(", "r", ")", "||", "r", "==", "'.'", "\n", "}" ]
// is Alpha Numeric reports whether r is an alphabetic, digit, or underscore, or period
[ "is", "Alpha", "Numeric", "reports", "whether", "r", "is", "an", "alphabetic", "digit", "or", "underscore", "or", "period" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L3227-L3229
20,523
araddon/qlbridge
lex/lexer.go
isIdentCh
func isIdentCh(r rune) bool { switch { case isAlNum(r): return true case r == '_': return true } return false }
go
func isIdentCh(r rune) bool { switch { case isAlNum(r): return true case r == '_': return true } return false }
[ "func", "isIdentCh", "(", "r", "rune", ")", "bool", "{", "switch", "{", "case", "isAlNum", "(", "r", ")", ":", "return", "true", "\n", "case", "r", "==", "'_'", ":", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}" ]
// Is the given rune valid in an identifier?
[ "Is", "the", "given", "rune", "valid", "in", "an", "identifier?" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L3253-L3261
20,524
araddon/qlbridge
lex/lexer.go
IsIdentifierRune
func IsIdentifierRune(r rune) bool { if unicode.IsLetter(r) || unicode.IsDigit(r) { return true } for _, allowedRune := range IDENTITY_CHARS { if allowedRune == r { return true } } return false }
go
func IsIdentifierRune(r rune) bool { if unicode.IsLetter(r) || unicode.IsDigit(r) { return true } for _, allowedRune := range IDENTITY_CHARS { if allowedRune == r { return true } } return false }
[ "func", "IsIdentifierRune", "(", "r", "rune", ")", "bool", "{", "if", "unicode", ".", "IsLetter", "(", "r", ")", "||", "unicode", ".", "IsDigit", "(", "r", ")", "{", "return", "true", "\n", "}", "\n", "for", "_", ",", "allowedRune", ":=", "range", ...
// IsIdentifierRune Is this a valid identity rune?
[ "IsIdentifierRune", "Is", "this", "a", "valid", "identity", "rune?" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L3264-L3274
20,525
araddon/qlbridge
lex/lexer.go
IsValidIdentity
func IsValidIdentity(identity string) bool { for _, r := range identity { if !isIdentifierFirstRune(r) { return false } break } return IdentityRunesOnly(identity) }
go
func IsValidIdentity(identity string) bool { for _, r := range identity { if !isIdentifierFirstRune(r) { return false } break } return IdentityRunesOnly(identity) }
[ "func", "IsValidIdentity", "(", "identity", "string", ")", "bool", "{", "for", "_", ",", "r", ":=", "range", "identity", "{", "if", "!", "isIdentifierFirstRune", "(", "r", ")", "{", "return", "false", "\n", "}", "\n", "break", "\n", "}", "\n", "return"...
// IsValidIdentity test the given string to determine if any characters are // not valid and therefore must be quoted
[ "IsValidIdentity", "test", "the", "given", "string", "to", "determine", "if", "any", "characters", "are", "not", "valid", "and", "therefore", "must", "be", "quoted" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/lexer.go#L3312-L3320
20,526
araddon/qlbridge
exec/groupby.go
NewGroupByFinal
func NewGroupByFinal(ctx *plan.Context, p *plan.GroupBy) *GroupByFinal { m := &GroupByFinal{ TaskBase: NewTaskBase(ctx), p: p, complete: make(chan bool), } return m }
go
func NewGroupByFinal(ctx *plan.Context, p *plan.GroupBy) *GroupByFinal { m := &GroupByFinal{ TaskBase: NewTaskBase(ctx), p: p, complete: make(chan bool), } return m }
[ "func", "NewGroupByFinal", "(", "ctx", "*", "plan", ".", "Context", ",", "p", "*", "plan", ".", "GroupBy", ")", "*", "GroupByFinal", "{", "m", ":=", "&", "GroupByFinal", "{", "TaskBase", ":", "NewTaskBase", "(", "ctx", ")", ",", "p", ":", "p", ",", ...
// NewGroupByFinal creates the group-by-finalizer task.
[ "NewGroupByFinal", "creates", "the", "group", "-", "by", "-", "finalizer", "task", "." ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/groupby.go#L62-L69
20,527
araddon/qlbridge
exec/groupby.go
Close
func (m *GroupBy) Close() error { m.Lock() if m.closed { m.Unlock() return nil } m.closed = true m.Unlock() return m.TaskBase.Close() }
go
func (m *GroupBy) Close() error { m.Lock() if m.closed { m.Unlock() return nil } m.closed = true m.Unlock() return m.TaskBase.Close() }
[ "func", "(", "m", "*", "GroupBy", ")", "Close", "(", ")", "error", "{", "m", ".", "Lock", "(", ")", "\n", "if", "m", ".", "closed", "{", "m", ".", "Unlock", "(", ")", "\n", "return", "nil", "\n", "}", "\n", "m", ".", "closed", "=", "true", ...
// Close the task, channels, cleanup.
[ "Close", "the", "task", "channels", "cleanup", "." ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/groupby.go#L281-L290
20,528
araddon/qlbridge
exec/groupby.go
Close
func (m *GroupByFinal) Close() error { m.Lock() if m.closed { m.Unlock() return nil } m.closed = true m.Unlock() ticker := time.NewTicker(30 * time.Second) defer ticker.Stop() //u.Infof("%p group by final Close() waiting for complete", m) select { case <-ticker.C: u.Warnf("timeout???? ") case <-m.com...
go
func (m *GroupByFinal) Close() error { m.Lock() if m.closed { m.Unlock() return nil } m.closed = true m.Unlock() ticker := time.NewTicker(30 * time.Second) defer ticker.Stop() //u.Infof("%p group by final Close() waiting for complete", m) select { case <-ticker.C: u.Warnf("timeout???? ") case <-m.com...
[ "func", "(", "m", "*", "GroupByFinal", ")", "Close", "(", ")", "error", "{", "m", ".", "Lock", "(", ")", "\n", "if", "m", ".", "closed", "{", "m", ".", "Unlock", "(", ")", "\n", "return", "nil", "\n", "}", "\n", "m", ".", "closed", "=", "true...
// Close the task and cleanup. Trys to wait for the downstream // reducer tasks to complete after flushing messages.
[ "Close", "the", "task", "and", "cleanup", ".", "Trys", "to", "wait", "for", "the", "downstream", "reducer", "tasks", "to", "complete", "after", "flushing", "messages", "." ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/groupby.go#L294-L315
20,529
araddon/qlbridge
datasource/files/filehandler.go
RegisterFileHandler
func RegisterFileHandler(scannerType string, fh FileHandler) { if fh == nil { panic("File scanners must not be nil") } scannerType = strings.ToLower(scannerType) // u.Debugf("global FileHandler register: %v %T FileHandler:%p", scannerType, fh, fh) registryMu.Lock() defer registryMu.Unlock() if _, dupe := scann...
go
func RegisterFileHandler(scannerType string, fh FileHandler) { if fh == nil { panic("File scanners must not be nil") } scannerType = strings.ToLower(scannerType) // u.Debugf("global FileHandler register: %v %T FileHandler:%p", scannerType, fh, fh) registryMu.Lock() defer registryMu.Unlock() if _, dupe := scann...
[ "func", "RegisterFileHandler", "(", "scannerType", "string", ",", "fh", "FileHandler", ")", "{", "if", "fh", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "scannerType", "=", "strings", ".", "ToLower", "(", "scannerType", ")", "\n", ...
// RegisterFileHandler Register a FileHandler available by the provided @scannerType
[ "RegisterFileHandler", "Register", "a", "FileHandler", "available", "by", "the", "provided" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/files/filehandler.go#L66-L78
20,530
araddon/qlbridge
datasource/context_wrapper.go
findValue
func findValue(v reflect.Value) (reflect.Value, bool) { for ; v.Kind() == reflect.Ptr || v.Kind() == reflect.Interface; v = v.Elem() { if v.IsNil() { return v, true } if v.Kind() == reflect.Interface && v.NumMethod() > 0 { break } } return v, false }
go
func findValue(v reflect.Value) (reflect.Value, bool) { for ; v.Kind() == reflect.Ptr || v.Kind() == reflect.Interface; v = v.Elem() { if v.IsNil() { return v, true } if v.Kind() == reflect.Interface && v.NumMethod() > 0 { break } } return v, false }
[ "func", "findValue", "(", "v", "reflect", ".", "Value", ")", "(", "reflect", ".", "Value", ",", "bool", ")", "{", "for", ";", "v", ".", "Kind", "(", ")", "==", "reflect", ".", "Ptr", "||", "v", ".", "Kind", "(", ")", "==", "reflect", ".", "Inte...
// unwind pointers, etc to find either the value or flag indicating was nil
[ "unwind", "pointers", "etc", "to", "find", "either", "the", "value", "or", "flag", "indicating", "was", "nil" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/context_wrapper.go#L51-L61
20,531
araddon/qlbridge
plan/projection.go
NewProjectionFinal
func NewProjectionFinal(ctx *Context, p *Select) (*Projection, error) { s := &Projection{ P: p, Stmt: p.Stmt, PlanBase: NewPlanBase(false), Final: true, } var err error if len(p.Stmt.From) == 0 { err = s.loadLiteralProjection(ctx) } else if len(p.From) == 1 && p.From[0].Proj != nil { s.Pr...
go
func NewProjectionFinal(ctx *Context, p *Select) (*Projection, error) { s := &Projection{ P: p, Stmt: p.Stmt, PlanBase: NewPlanBase(false), Final: true, } var err error if len(p.Stmt.From) == 0 { err = s.loadLiteralProjection(ctx) } else if len(p.From) == 1 && p.From[0].Proj != nil { s.Pr...
[ "func", "NewProjectionFinal", "(", "ctx", "*", "Context", ",", "p", "*", "Select", ")", "(", "*", "Projection", ",", "error", ")", "{", "s", ":=", "&", "Projection", "{", "P", ":", "p", ",", "Stmt", ":", "p", ".", "Stmt", ",", "PlanBase", ":", "N...
// Final Projections project final select columns for result-writing
[ "Final", "Projections", "project", "final", "select", "columns", "for", "result", "-", "writing" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/plan/projection.go#L22-L41
20,532
araddon/qlbridge
expr/funcs.go
EmptyEvalFunc
func EmptyEvalFunc(ctx EvalContext, args []value.Value) (value.Value, bool) { return value.NilValueVal, false }
go
func EmptyEvalFunc(ctx EvalContext, args []value.Value) (value.Value, bool) { return value.NilValueVal, false }
[ "func", "EmptyEvalFunc", "(", "ctx", "EvalContext", ",", "args", "[", "]", "value", ".", "Value", ")", "(", "value", ".", "Value", ",", "bool", ")", "{", "return", "value", ".", "NilValueVal", ",", "false", "\n", "}" ]
// EmptyEvalFunc a no-op evaluation function for use in
[ "EmptyEvalFunc", "a", "no", "-", "op", "evaluation", "function", "for", "use", "in" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/expr/funcs.go#L46-L48
20,533
araddon/qlbridge
expr/funcs.go
NewFuncRegistry
func NewFuncRegistry() *FuncRegistry { return &FuncRegistry{ funcs: make(map[string]Func), aggs: make(map[string]struct{}), } }
go
func NewFuncRegistry() *FuncRegistry { return &FuncRegistry{ funcs: make(map[string]Func), aggs: make(map[string]struct{}), } }
[ "func", "NewFuncRegistry", "(", ")", "*", "FuncRegistry", "{", "return", "&", "FuncRegistry", "{", "funcs", ":", "make", "(", "map", "[", "string", "]", "Func", ")", ",", "aggs", ":", "make", "(", "map", "[", "string", "]", "struct", "{", "}", ")", ...
// NewFuncRegistry create a new function registry. By default their is a // global one, but you can have local function registries as well.
[ "NewFuncRegistry", "create", "a", "new", "function", "registry", ".", "By", "default", "their", "is", "a", "global", "one", "but", "you", "can", "have", "local", "function", "registries", "as", "well", "." ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/expr/funcs.go#L52-L57
20,534
araddon/qlbridge
expr/funcs.go
FuncGet
func (m *FuncRegistry) FuncGet(name string) (Func, bool) { m.mu.RLock() fn, ok := m.funcs[name] m.mu.RUnlock() return fn, ok }
go
func (m *FuncRegistry) FuncGet(name string) (Func, bool) { m.mu.RLock() fn, ok := m.funcs[name] m.mu.RUnlock() return fn, ok }
[ "func", "(", "m", "*", "FuncRegistry", ")", "FuncGet", "(", "name", "string", ")", "(", "Func", ",", "bool", ")", "{", "m", ".", "mu", ".", "RLock", "(", ")", "\n", "fn", ",", "ok", ":=", "m", ".", "funcs", "[", "name", "]", "\n", "m", ".", ...
// FuncGet gets a function from registry if it exists.
[ "FuncGet", "gets", "a", "function", "from", "registry", "if", "it", "exists", "." ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/expr/funcs.go#L76-L81
20,535
araddon/qlbridge
expr/builtins/list_map.go
Validate
func (m *ArraySlice) Validate(n *expr.FuncNode) (expr.EvaluatorFunc, error) { if len(n.Args) < 2 || len(n.Args) > 3 { return nil, fmt.Errorf("Expected 2 OR 3 args for ArraySlice(array, start, [end]) but got %s", n) } return arraySliceEval, nil }
go
func (m *ArraySlice) Validate(n *expr.FuncNode) (expr.EvaluatorFunc, error) { if len(n.Args) < 2 || len(n.Args) > 3 { return nil, fmt.Errorf("Expected 2 OR 3 args for ArraySlice(array, start, [end]) but got %s", n) } return arraySliceEval, nil }
[ "func", "(", "m", "*", "ArraySlice", ")", "Validate", "(", "n", "*", "expr", ".", "FuncNode", ")", "(", "expr", ".", "EvaluatorFunc", ",", "error", ")", "{", "if", "len", "(", "n", ".", "Args", ")", "<", "2", "||", "len", "(", "n", ".", "Args",...
// Validate must be at least 2 args, max of 3
[ "Validate", "must", "be", "at", "least", "2", "args", "max", "of", "3" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/expr/builtins/list_map.go#L123-L128
20,536
araddon/qlbridge
vm/filterqlvm.go
EvalFilterSelect
func EvalFilterSelect(sel *rel.FilterSelect, writeContext expr.ContextWriter, readContext expr.EvalContext) (bool, bool) { ctx, ok := readContext.(expr.EvalIncludeContext) if !ok { ctx = &expr.IncludeContext{ContextReader: readContext} } // Check and see if we are where Guarded, which would discard the entire me...
go
func EvalFilterSelect(sel *rel.FilterSelect, writeContext expr.ContextWriter, readContext expr.EvalContext) (bool, bool) { ctx, ok := readContext.(expr.EvalIncludeContext) if !ok { ctx = &expr.IncludeContext{ContextReader: readContext} } // Check and see if we are where Guarded, which would discard the entire me...
[ "func", "EvalFilterSelect", "(", "sel", "*", "rel", ".", "FilterSelect", ",", "writeContext", "expr", ".", "ContextWriter", ",", "readContext", "expr", ".", "EvalContext", ")", "(", "bool", ",", "bool", ")", "{", "ctx", ",", "ok", ":=", "readContext", ".",...
// EvalFilerSelect evaluates a FilterSelect statement from read, into write context // // @writeContext = Write results of projection // @readContext = Message input, ie evaluate for Where/Filter clause
[ "EvalFilerSelect", "evaluates", "a", "FilterSelect", "statement", "from", "read", "into", "write", "context" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/vm/filterqlvm.go#L26-L71
20,537
araddon/qlbridge
vm/filterqlvm.go
MatchesExpr
func MatchesExpr(cr expr.EvalContext, node expr.Node) (bool, bool) { return matchesExpr(cr, node, 0) }
go
func MatchesExpr(cr expr.EvalContext, node expr.Node) (bool, bool) { return matchesExpr(cr, node, 0) }
[ "func", "MatchesExpr", "(", "cr", "expr", ".", "EvalContext", ",", "node", "expr", ".", "Node", ")", "(", "bool", ",", "bool", ")", "{", "return", "matchesExpr", "(", "cr", ",", "node", ",", "0", ")", "\n", "}" ]
// MatchesExpr executes a expr.Node expression against an evaluation context // returning true if the context matches.
[ "MatchesExpr", "executes", "a", "expr", ".", "Node", "expression", "against", "an", "evaluation", "context", "returning", "true", "if", "the", "context", "matches", "." ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/vm/filterqlvm.go#L87-L89
20,538
araddon/qlbridge
generators/elasticsearch/esgen/esgenerator.go
DayBucket
func DayBucket(dt time.Time) int { return int(dt.UnixNano() / int64(24*time.Hour)) }
go
func DayBucket(dt time.Time) int { return int(dt.UnixNano() / int64(24*time.Hour)) }
[ "func", "DayBucket", "(", "dt", "time", ".", "Time", ")", "int", "{", "return", "int", "(", "dt", ".", "UnixNano", "(", ")", "/", "int64", "(", "24", "*", "time", ".", "Hour", ")", ")", "\n", "}" ]
// copy-pasta from entity to avoid the import // when we actually parameterize this we will need to do it differently anyway
[ "copy", "-", "pasta", "from", "entity", "to", "avoid", "the", "import", "when", "we", "actually", "parameterize", "this", "we", "will", "need", "to", "do", "it", "differently", "anyway" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/generators/elasticsearch/esgen/esgenerator.go#L27-L29
20,539
araddon/qlbridge
generators/elasticsearch/esgen/esgenerator.go
walkExpr
func (fg *FilterGenerator) walkExpr(node expr.Node, depth int) (interface{}, error) { if depth > MaxDepth { return nil, fmt.Errorf("hit max depth on segment generation. bad query?") } //u.Debugf("%d fg.expr T:%T %#v", depth, node, node) var err error var filter interface{} switch n := node.(type) { case *expr...
go
func (fg *FilterGenerator) walkExpr(node expr.Node, depth int) (interface{}, error) { if depth > MaxDepth { return nil, fmt.Errorf("hit max depth on segment generation. bad query?") } //u.Debugf("%d fg.expr T:%T %#v", depth, node, node) var err error var filter interface{} switch n := node.(type) { case *expr...
[ "func", "(", "fg", "*", "FilterGenerator", ")", "walkExpr", "(", "node", "expr", ".", "Node", ",", "depth", "int", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "if", "depth", ">", "MaxDepth", "{", "return", "nil", ",", "fmt", ".", "Erro...
// expr dispatches to node-type-specific methods
[ "expr", "dispatches", "to", "node", "-", "type", "-", "specific", "methods" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/generators/elasticsearch/esgen/esgenerator.go#L58-L115
20,540
araddon/qlbridge
datasource/files/file.go
Values
func (m *FileInfo) Values() []driver.Value { cols := []driver.Value{ m.Name, m.Table, m.Path, m.PartialPath, m.Size, m.Partition, m.updated(), false, m.FileType, } cols = append(cols, m.AppendCols...) return cols }
go
func (m *FileInfo) Values() []driver.Value { cols := []driver.Value{ m.Name, m.Table, m.Path, m.PartialPath, m.Size, m.Partition, m.updated(), false, m.FileType, } cols = append(cols, m.AppendCols...) return cols }
[ "func", "(", "m", "*", "FileInfo", ")", "Values", "(", ")", "[", "]", "driver", ".", "Value", "{", "cols", ":=", "[", "]", "driver", ".", "Value", "{", "m", ".", "Name", ",", "m", ".", "Table", ",", "m", ".", "Path", ",", "m", ".", "PartialPa...
// Values as as slice, create a row of values describing this file // for use in sql listing of files
[ "Values", "as", "as", "slice", "create", "a", "row", "of", "values", "describing", "this", "file", "for", "use", "in", "sql", "listing", "of", "files" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/files/file.go#L62-L76
20,541
araddon/qlbridge
datasource/files/file.go
FileInfoFromCloudObject
func FileInfoFromCloudObject(path string, obj cloudstorage.Object) *FileInfo { fi := &FileInfo{Name: obj.Name(), obj: obj, Path: path} fi.Table = TableFromFileAndPath(path, obj.Name()) // Get the part of path as follows // /path/partialpath/filename.csv partialPath := strings.Replace(fi.Name, path, "", 1) par...
go
func FileInfoFromCloudObject(path string, obj cloudstorage.Object) *FileInfo { fi := &FileInfo{Name: obj.Name(), obj: obj, Path: path} fi.Table = TableFromFileAndPath(path, obj.Name()) // Get the part of path as follows // /path/partialpath/filename.csv partialPath := strings.Replace(fi.Name, path, "", 1) par...
[ "func", "FileInfoFromCloudObject", "(", "path", "string", ",", "obj", "cloudstorage", ".", "Object", ")", "*", "FileInfo", "{", "fi", ":=", "&", "FileInfo", "{", "Name", ":", "obj", ".", "Name", "(", ")", ",", "obj", ":", "obj", ",", "Path", ":", "pa...
// Convert a cloudstorage object to a File. Interpret the table name // for given full file path.
[ "Convert", "a", "cloudstorage", "object", "to", "a", "File", ".", "Interpret", "the", "table", "name", "for", "given", "full", "file", "path", "." ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/files/file.go#L87-L102
20,542
araddon/qlbridge
exec/command.go
NewCommand
func NewCommand(ctx *plan.Context, p *plan.Command) *Command { m := &Command{ TaskBase: NewTaskBase(ctx), p: p, } return m }
go
func NewCommand(ctx *plan.Context, p *plan.Command) *Command { m := &Command{ TaskBase: NewTaskBase(ctx), p: p, } return m }
[ "func", "NewCommand", "(", "ctx", "*", "plan", ".", "Context", ",", "p", "*", "plan", ".", "Command", ")", "*", "Command", "{", "m", ":=", "&", "Command", "{", "TaskBase", ":", "NewTaskBase", "(", "ctx", ")", ",", "p", ":", "p", ",", "}", "\n", ...
// NewCommand creates new command exec task
[ "NewCommand", "creates", "new", "command", "exec", "task" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/command.go#L30-L36
20,543
araddon/qlbridge
rel/parse_filterql.go
FuncResolver
func (f *FilterQLParser) FuncResolver(funcs expr.FuncResolver) *FilterQLParser { f.funcs = funcs return f }
go
func (f *FilterQLParser) FuncResolver(funcs expr.FuncResolver) *FilterQLParser { f.funcs = funcs return f }
[ "func", "(", "f", "*", "FilterQLParser", ")", "FuncResolver", "(", "funcs", "expr", ".", "FuncResolver", ")", "*", "FilterQLParser", "{", "f", ".", "funcs", "=", "funcs", "\n", "return", "f", "\n", "}" ]
// FuncResolver sets the function resolver to use during parsing. By default we only use the Global resolver. // But if you set a function resolver we'll use that first and then fall back to the Global resolver.
[ "FuncResolver", "sets", "the", "function", "resolver", "to", "use", "during", "parsing", ".", "By", "default", "we", "only", "use", "the", "Global", "resolver", ".", "But", "if", "you", "set", "a", "function", "resolver", "we", "ll", "use", "that", "first"...
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/parse_filterql.go#L36-L39
20,544
araddon/qlbridge
rel/parse_filterql.go
ParseFilters
func ParseFilters(statement string) (stmts []*FilterStatement, err error) { return NewFilterParser(statement).ParseFilters() }
go
func ParseFilters(statement string) (stmts []*FilterStatement, err error) { return NewFilterParser(statement).ParseFilters() }
[ "func", "ParseFilters", "(", "statement", "string", ")", "(", "stmts", "[", "]", "*", "FilterStatement", ",", "err", "error", ")", "{", "return", "NewFilterParser", "(", "statement", ")", ".", "ParseFilters", "(", ")", "\n", "}" ]
// ParseFilters Parse a list of Filter statement's from text
[ "ParseFilters", "Parse", "a", "list", "of", "Filter", "statement", "s", "from", "text" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/parse_filterql.go#L104-L106
20,545
araddon/qlbridge
rel/parse_filterql.go
parseFilter
func (m *FilterQLParser) parseFilter() (*FilterStatement, error) { req := NewFilterStatement() m.fs = req req.Description = m.comment req.Raw = m.l.RawInput() m.Next() // Consume (FILTER | WHERE ) // one top level filter which may be nested filter, err := m.parseFirstFilters() if err != nil { return nil, er...
go
func (m *FilterQLParser) parseFilter() (*FilterStatement, error) { req := NewFilterStatement() m.fs = req req.Description = m.comment req.Raw = m.l.RawInput() m.Next() // Consume (FILTER | WHERE ) // one top level filter which may be nested filter, err := m.parseFirstFilters() if err != nil { return nil, er...
[ "func", "(", "m", "*", "FilterQLParser", ")", "parseFilter", "(", ")", "(", "*", "FilterStatement", ",", "error", ")", "{", "req", ":=", "NewFilterStatement", "(", ")", "\n", "m", ".", "fs", "=", "req", "\n", "req", ".", "Description", "=", "m", ".",...
// First keyword was FILTER, so use the FILTER parser rule-set
[ "First", "keyword", "was", "FILTER", "so", "use", "the", "FILTER", "parser", "rule", "-", "set" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/parse_filterql.go#L343-L400
20,546
araddon/qlbridge
vm/datemath.go
NewDateConverter
func NewDateConverter(ctx expr.EvalIncludeContext, n expr.Node) (*DateConverter, error) { dc := &DateConverter{ Node: n, at: time.Now(), ctx: ctx, } dc.findDateMath(n) if dc.err == nil && len(dc.TimeStrings) > 0 { dc.HasDateMath = true } if dc.err != nil { return nil, dc.err } return dc, nil }
go
func NewDateConverter(ctx expr.EvalIncludeContext, n expr.Node) (*DateConverter, error) { dc := &DateConverter{ Node: n, at: time.Now(), ctx: ctx, } dc.findDateMath(n) if dc.err == nil && len(dc.TimeStrings) > 0 { dc.HasDateMath = true } if dc.err != nil { return nil, dc.err } return dc, nil }
[ "func", "NewDateConverter", "(", "ctx", "expr", ".", "EvalIncludeContext", ",", "n", "expr", ".", "Node", ")", "(", "*", "DateConverter", ",", "error", ")", "{", "dc", ":=", "&", "DateConverter", "{", "Node", ":", "n", ",", "at", ":", "time", ".", "N...
// NewDateConverter takes a node expression
[ "NewDateConverter", "takes", "a", "node", "expression" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/vm/datemath.go#L32-L46
20,547
araddon/qlbridge
generators/elasticsearch/es2gen/esgenerator.go
booleanExpr
func (fg *FilterGenerator) booleanExpr(bn *expr.BooleanNode, depth int) (interface{}, error) { if depth > MaxDepth { return nil, fmt.Errorf("hit max depth on segment generation. bad query?") } and := true switch bn.Operator.T { case lex.TokenAnd, lex.TokenLogicAnd: case lex.TokenOr, lex.TokenLogicOr: and = fa...
go
func (fg *FilterGenerator) booleanExpr(bn *expr.BooleanNode, depth int) (interface{}, error) { if depth > MaxDepth { return nil, fmt.Errorf("hit max depth on segment generation. bad query?") } and := true switch bn.Operator.T { case lex.TokenAnd, lex.TokenLogicAnd: case lex.TokenOr, lex.TokenLogicOr: and = fa...
[ "func", "(", "fg", "*", "FilterGenerator", ")", "booleanExpr", "(", "bn", "*", "expr", ".", "BooleanNode", ",", "depth", "int", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "if", "depth", ">", "MaxDepth", "{", "return", "nil", ",", "fmt",...
// filters returns a boolean expression
[ "filters", "returns", "a", "boolean", "expression" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/generators/elasticsearch/es2gen/esgenerator.go#L142-L187
20,548
araddon/qlbridge
expr/parse.go
Next
func (m *LexTokenPager) Next() lex.Token { m.lexNext() m.cursor++ if m.cursor+1 > len(m.tokens) { //u.Warnf("Next() CRAP? increment cursor: %v of %v %v", m.cursor, len(m.tokens)) return eoft } return m.tokens[m.cursor-1] }
go
func (m *LexTokenPager) Next() lex.Token { m.lexNext() m.cursor++ if m.cursor+1 > len(m.tokens) { //u.Warnf("Next() CRAP? increment cursor: %v of %v %v", m.cursor, len(m.tokens)) return eoft } return m.tokens[m.cursor-1] }
[ "func", "(", "m", "*", "LexTokenPager", ")", "Next", "(", ")", "lex", ".", "Token", "{", "m", ".", "lexNext", "(", ")", "\n", "m", ".", "cursor", "++", "\n", "if", "m", ".", "cursor", "+", "1", ">", "len", "(", "m", ".", "tokens", ")", "{", ...
// Next returns the current token and advances cursor to next one
[ "Next", "returns", "the", "current", "token", "and", "advances", "cursor", "to", "next", "one" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/expr/parse.go#L94-L102
20,549
araddon/qlbridge
expr/parse.go
Cur
func (m *LexTokenPager) Cur() lex.Token { if m.cursor+1 > len(m.tokens) { //u.Warnf("Next() CRAP? increment cursor: %v of %v %v", m.cursor, len(m.tokens), m.cursor < len(m.tokens)) return eoft } return m.tokens[m.cursor] }
go
func (m *LexTokenPager) Cur() lex.Token { if m.cursor+1 > len(m.tokens) { //u.Warnf("Next() CRAP? increment cursor: %v of %v %v", m.cursor, len(m.tokens), m.cursor < len(m.tokens)) return eoft } return m.tokens[m.cursor] }
[ "func", "(", "m", "*", "LexTokenPager", ")", "Cur", "(", ")", "lex", ".", "Token", "{", "if", "m", ".", "cursor", "+", "1", ">", "len", "(", "m", ".", "tokens", ")", "{", "//u.Warnf(\"Next() CRAP? increment cursor: %v of %v %v\", m.cursor, len(m.tokens), m.curso...
// Returns the current token, does not advance
[ "Returns", "the", "current", "token", "does", "not", "advance" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/expr/parse.go#L105-L111
20,550
araddon/qlbridge
expr/parse.go
Peek
func (m *LexTokenPager) Peek() lex.Token { if len(m.tokens) <= m.cursor+1 && !m.done { m.lexNext() } if len(m.tokens) < 2 { m.lexNext() } if len(m.tokens) == m.cursor+1 { return m.tokens[m.cursor] } if m.cursor == -1 { return m.tokens[1] } return m.tokens[m.cursor+1] }
go
func (m *LexTokenPager) Peek() lex.Token { if len(m.tokens) <= m.cursor+1 && !m.done { m.lexNext() } if len(m.tokens) < 2 { m.lexNext() } if len(m.tokens) == m.cursor+1 { return m.tokens[m.cursor] } if m.cursor == -1 { return m.tokens[1] } return m.tokens[m.cursor+1] }
[ "func", "(", "m", "*", "LexTokenPager", ")", "Peek", "(", ")", "lex", ".", "Token", "{", "if", "len", "(", "m", ".", "tokens", ")", "<=", "m", ".", "cursor", "+", "1", "&&", "!", "m", ".", "done", "{", "m", ".", "lexNext", "(", ")", "\n", "...
// Peek returns but does not consume the next token.
[ "Peek", "returns", "but", "does", "not", "consume", "the", "next", "token", "." ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/expr/parse.go#L137-L151
20,551
araddon/qlbridge
expr/parse.go
expect
func (t *tree) expect(expected lex.TokenType, context string) lex.Token { token := t.Cur() if token.T != expected { t.unexpected(token, context) } return token }
go
func (t *tree) expect(expected lex.TokenType, context string) lex.Token { token := t.Cur() if token.T != expected { t.unexpected(token, context) } return token }
[ "func", "(", "t", "*", "tree", ")", "expect", "(", "expected", "lex", ".", "TokenType", ",", "context", "string", ")", "lex", ".", "Token", "{", "token", ":=", "t", ".", "Cur", "(", ")", "\n", "if", "token", ".", "T", "!=", "expected", "{", "t", ...
// expect verifies the current token and guarantees it has the required type
[ "expect", "verifies", "the", "current", "token", "and", "guarantees", "it", "has", "the", "required", "type" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/expr/parse.go#L228-L234
20,552
araddon/qlbridge
expr/parse.go
parse
func (t *tree) parse() (_ Node, err error) { defer func() { if p := recover(); p != nil { err = fmt.Errorf("parse error: %v", p) } }() return t.O(0), err }
go
func (t *tree) parse() (_ Node, err error) { defer func() { if p := recover(); p != nil { err = fmt.Errorf("parse error: %v", p) } }() return t.O(0), err }
[ "func", "(", "t", "*", "tree", ")", "parse", "(", ")", "(", "_", "Node", ",", "err", "error", ")", "{", "defer", "func", "(", ")", "{", "if", "p", ":=", "recover", "(", ")", ";", "p", "!=", "nil", "{", "err", "=", "fmt", ".", "Errorf", "(",...
// parse take the tokens and recursively build into Node
[ "parse", "take", "the", "tokens", "and", "recursively", "build", "into", "Node" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/expr/parse.go#L265-L272
20,553
araddon/qlbridge
expr/parse.go
getFunction
func (t *tree) getFunction(name string) (fn Func, ok bool) { if t.fr != nil { if fn, ok = t.fr.FuncGet(name); ok { return } } if fn, ok = funcReg.FuncGet(strings.ToLower(name)); ok { return } return }
go
func (t *tree) getFunction(name string) (fn Func, ok bool) { if t.fr != nil { if fn, ok = t.fr.FuncGet(name); ok { return } } if fn, ok = funcReg.FuncGet(strings.ToLower(name)); ok { return } return }
[ "func", "(", "t", "*", "tree", ")", "getFunction", "(", "name", "string", ")", "(", "fn", "Func", ",", "ok", "bool", ")", "{", "if", "t", ".", "fr", "!=", "nil", "{", "if", "fn", ",", "ok", "=", "t", ".", "fr", ".", "FuncGet", "(", "name", ...
// get Function from Global function registry.
[ "get", "Function", "from", "Global", "function", "registry", "." ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/expr/parse.go#L776-L786
20,554
araddon/qlbridge
datasource/json.go
NewJsonSource
func NewJsonSource(table string, rc io.ReadCloser, exit <-chan bool, lh FileLineHandler) (*JsonSource, error) { js := &JsonSource{ table: table, exit: exit, rc: rc, lhSpec: lh, lh: lh, } buf := bufio.NewReader(rc) first2, err := buf.Peek(2) if err != nil { u.Warnf("error opening bufio.peek...
go
func NewJsonSource(table string, rc io.ReadCloser, exit <-chan bool, lh FileLineHandler) (*JsonSource, error) { js := &JsonSource{ table: table, exit: exit, rc: rc, lhSpec: lh, lh: lh, } buf := bufio.NewReader(rc) first2, err := buf.Peek(2) if err != nil { u.Warnf("error opening bufio.peek...
[ "func", "NewJsonSource", "(", "table", "string", ",", "rc", "io", ".", "ReadCloser", ",", "exit", "<-", "chan", "bool", ",", "lh", "FileLineHandler", ")", "(", "*", "JsonSource", ",", "error", ")", "{", "js", ":=", "&", "JsonSource", "{", "table", ":",...
// NewJsonSource reader assumes we are getting NEW LINE delimted json file // - optionally may be gzipped
[ "NewJsonSource", "reader", "assumes", "we", "are", "getting", "NEW", "LINE", "delimted", "json", "file", "-", "optionally", "may", "be", "gzipped" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/json.go#L54-L90
20,555
araddon/qlbridge
exec/ddl.go
NewCreate
func NewCreate(ctx *plan.Context, p *plan.Create) *Create { m := &Create{ TaskBase: NewTaskBase(ctx), p: p, } return m }
go
func NewCreate(ctx *plan.Context, p *plan.Create) *Create { m := &Create{ TaskBase: NewTaskBase(ctx), p: p, } return m }
[ "func", "NewCreate", "(", "ctx", "*", "plan", ".", "Context", ",", "p", "*", "plan", ".", "Create", ")", "*", "Create", "{", "m", ":=", "&", "Create", "{", "TaskBase", ":", "NewTaskBase", "(", "ctx", ")", ",", "p", ":", "p", ",", "}", "\n", "re...
// NewCreate creates new create exec task
[ "NewCreate", "creates", "new", "create", "exec", "task" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/ddl.go#L40-L46
20,556
araddon/qlbridge
exec/ddl.go
NewDrop
func NewDrop(ctx *plan.Context, p *plan.Drop) *Drop { m := &Drop{ TaskBase: NewTaskBase(ctx), p: p, } return m }
go
func NewDrop(ctx *plan.Context, p *plan.Drop) *Drop { m := &Drop{ TaskBase: NewTaskBase(ctx), p: p, } return m }
[ "func", "NewDrop", "(", "ctx", "*", "plan", ".", "Context", ",", "p", "*", "plan", ".", "Drop", ")", "*", "Drop", "{", "m", ":=", "&", "Drop", "{", "TaskBase", ":", "NewTaskBase", "(", "ctx", ")", ",", "p", ":", "p", ",", "}", "\n", "return", ...
// NewDrop creates new drop exec task.
[ "NewDrop", "creates", "new", "drop", "exec", "task", "." ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/ddl.go#L100-L106
20,557
araddon/qlbridge
exec/ddl.go
NewAlter
func NewAlter(ctx *plan.Context, p *plan.Alter) *Alter { m := &Alter{ TaskBase: NewTaskBase(ctx), p: p, } return m }
go
func NewAlter(ctx *plan.Context, p *plan.Alter) *Alter { m := &Alter{ TaskBase: NewTaskBase(ctx), p: p, } return m }
[ "func", "NewAlter", "(", "ctx", "*", "plan", ".", "Context", ",", "p", "*", "plan", ".", "Alter", ")", "*", "Alter", "{", "m", ":=", "&", "Alter", "{", "TaskBase", ":", "NewTaskBase", "(", "ctx", ")", ",", "p", ":", "p", ",", "}", "\n", "return...
// NewAlter creates new ALTER exec task.
[ "NewAlter", "creates", "new", "ALTER", "exec", "task", "." ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/ddl.go#L136-L142
20,558
araddon/qlbridge
datasource/membtree/btree.go
NewStaticDataValue
func NewStaticDataValue(name string, data interface{}) *StaticDataSource { row := []driver.Value{data} ds := NewStaticDataSource(name, 0, [][]driver.Value{row}, []string{name}) return ds }
go
func NewStaticDataValue(name string, data interface{}) *StaticDataSource { row := []driver.Value{data} ds := NewStaticDataSource(name, 0, [][]driver.Value{row}, []string{name}) return ds }
[ "func", "NewStaticDataValue", "(", "name", "string", ",", "data", "interface", "{", "}", ")", "*", "StaticDataSource", "{", "row", ":=", "[", "]", "driver", ".", "Value", "{", "data", "}", "\n", "ds", ":=", "NewStaticDataSource", "(", "name", ",", "0", ...
// StaticDataValue is used to create a static name=value pair that matches // DataSource interfaces
[ "StaticDataValue", "is", "used", "to", "create", "a", "static", "name", "=", "value", "pair", "that", "matches", "DataSource", "interfaces" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/membtree/btree.go#L147-L151
20,559
araddon/qlbridge
expr/dialect.go
NewDialectWriter
func NewDialectWriter(l, i byte) DialectWriter { return &defaultDialect{LiteralQuote: l, IdentityQuote: i} }
go
func NewDialectWriter(l, i byte) DialectWriter { return &defaultDialect{LiteralQuote: l, IdentityQuote: i} }
[ "func", "NewDialectWriter", "(", "l", ",", "i", "byte", ")", "DialectWriter", "{", "return", "&", "defaultDialect", "{", "LiteralQuote", ":", "l", ",", "IdentityQuote", ":", "i", "}", "\n", "}" ]
// NewDialectWriter creates a writer that is custom literal and identity // escape characters
[ "NewDialectWriter", "creates", "a", "writer", "that", "is", "custom", "literal", "and", "identity", "escape", "characters" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/expr/dialect.go#L62-L64
20,560
araddon/qlbridge
expr/dialect.go
WriteLiteral
func (w *defaultDialect) WriteLiteral(l string) { if len(l) == 1 && l == "*" { w.WriteByte('*') return } LiteralQuoteEscapeBuf(&w.Buffer, rune(w.LiteralQuote), l) }
go
func (w *defaultDialect) WriteLiteral(l string) { if len(l) == 1 && l == "*" { w.WriteByte('*') return } LiteralQuoteEscapeBuf(&w.Buffer, rune(w.LiteralQuote), l) }
[ "func", "(", "w", "*", "defaultDialect", ")", "WriteLiteral", "(", "l", "string", ")", "{", "if", "len", "(", "l", ")", "==", "1", "&&", "l", "==", "\"", "\"", "{", "w", ".", "WriteByte", "(", "'*'", ")", "\n", "return", "\n", "}", "\n", "Liter...
// WriteLiteral writes literal with escapes if needed
[ "WriteLiteral", "writes", "literal", "with", "escapes", "if", "needed" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/expr/dialect.go#L91-L97
20,561
araddon/qlbridge
expr/dialect.go
WriteIdentity
func (w *defaultDialect) WriteIdentity(i string) { if len(i) == 1 && i == "*" { w.WriteByte('*') return } IdentityMaybeEscapeBuf(&w.Buffer, w.IdentityQuote, i) }
go
func (w *defaultDialect) WriteIdentity(i string) { if len(i) == 1 && i == "*" { w.WriteByte('*') return } IdentityMaybeEscapeBuf(&w.Buffer, w.IdentityQuote, i) }
[ "func", "(", "w", "*", "defaultDialect", ")", "WriteIdentity", "(", "i", "string", ")", "{", "if", "len", "(", "i", ")", "==", "1", "&&", "i", "==", "\"", "\"", "{", "w", ".", "WriteByte", "(", "'*'", ")", "\n", "return", "\n", "}", "\n", "Iden...
// WriteIdentity writes identity with escaping if needed
[ "WriteIdentity", "writes", "identity", "with", "escaping", "if", "needed" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/expr/dialect.go#L100-L106
20,562
araddon/qlbridge
expr/dialect.go
WriteLeftRightIdentity
func (w *defaultDialect) WriteLeftRightIdentity(l, r string) { if l == "" { w.WriteIdentity(r) return } // `user`.`email` type namespacing, may need to be escaped differently if w.stripNamespace { w.WriteIdentity(r) return } w.WriteIdentity(l) w.Write([]byte{'.'}) w.WriteIdentity(r) return }
go
func (w *defaultDialect) WriteLeftRightIdentity(l, r string) { if l == "" { w.WriteIdentity(r) return } // `user`.`email` type namespacing, may need to be escaped differently if w.stripNamespace { w.WriteIdentity(r) return } w.WriteIdentity(l) w.Write([]byte{'.'}) w.WriteIdentity(r) return }
[ "func", "(", "w", "*", "defaultDialect", ")", "WriteLeftRightIdentity", "(", "l", ",", "r", "string", ")", "{", "if", "l", "==", "\"", "\"", "{", "w", ".", "WriteIdentity", "(", "r", ")", "\n", "return", "\n", "}", "\n\n", "// `user`.`email` type names...
// WriteLeftRightIdentity writes identity with escaping if needed
[ "WriteLeftRightIdentity", "writes", "identity", "with", "escaping", "if", "needed" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/expr/dialect.go#L109-L124
20,563
araddon/qlbridge
expr/dialect.go
WriteIdentityQuote
func (w *defaultDialect) WriteIdentityQuote(i string, quote byte) { if len(i) == 1 && i == "*" { w.WriteByte('*') return } LiteralQuoteEscapeBuf(&w.Buffer, rune(w.IdentityQuote), i) }
go
func (w *defaultDialect) WriteIdentityQuote(i string, quote byte) { if len(i) == 1 && i == "*" { w.WriteByte('*') return } LiteralQuoteEscapeBuf(&w.Buffer, rune(w.IdentityQuote), i) }
[ "func", "(", "w", "*", "defaultDialect", ")", "WriteIdentityQuote", "(", "i", "string", ",", "quote", "byte", ")", "{", "if", "len", "(", "i", ")", "==", "1", "&&", "i", "==", "\"", "\"", "{", "w", ".", "WriteByte", "(", "'*'", ")", "\n", "return...
// WriteIdentityQuote write out an identity using given quote character
[ "WriteIdentityQuote", "write", "out", "an", "identity", "using", "given", "quote", "character" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/expr/dialect.go#L127-L133
20,564
araddon/qlbridge
expr/dialect.go
WriteLiteral
func (w *jsonDialect) WriteLiteral(l string) { if len(l) == 1 && l == "*" { w.WriteByte('*') return } w.Buffer.WriteString(strconv.Quote(l)) }
go
func (w *jsonDialect) WriteLiteral(l string) { if len(l) == 1 && l == "*" { w.WriteByte('*') return } w.Buffer.WriteString(strconv.Quote(l)) }
[ "func", "(", "w", "*", "jsonDialect", ")", "WriteLiteral", "(", "l", "string", ")", "{", "if", "len", "(", "l", ")", "==", "1", "&&", "l", "==", "\"", "\"", "{", "w", ".", "WriteByte", "(", "'*'", ")", "\n", "return", "\n", "}", "\n", "w", "....
// WriteLiteral writes literal and escapes " with \"
[ "WriteLiteral", "writes", "literal", "and", "escapes", "with", "\\" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/expr/dialect.go#L178-L184
20,565
araddon/qlbridge
exec/where.go
NewWhere
func NewWhere(ctx *plan.Context, p *plan.Where) *Where { if p.Final { return NewWhereFinal(ctx, p) } return NewWhereFilter(ctx, p.Stmt) }
go
func NewWhere(ctx *plan.Context, p *plan.Where) *Where { if p.Final { return NewWhereFinal(ctx, p) } return NewWhereFilter(ctx, p.Stmt) }
[ "func", "NewWhere", "(", "ctx", "*", "plan", ".", "Context", ",", "p", "*", "plan", ".", "Where", ")", "*", "Where", "{", "if", "p", ".", "Final", "{", "return", "NewWhereFinal", "(", "ctx", ",", "p", ")", "\n", "}", "\n", "return", "NewWhereFilter...
// NewWhere create new Where Clause // filters vs final differ bc the Final does final column aliasing
[ "NewWhere", "create", "new", "Where", "Clause", "filters", "vs", "final", "differ", "bc", "the", "Final", "does", "final", "column", "aliasing" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/where.go#L24-L29
20,566
araddon/qlbridge
exec/where.go
NewWhereFilter
func NewWhereFilter(ctx *plan.Context, sql *rel.SqlSelect) *Where { s := &Where{ TaskBase: NewTaskBase(ctx), filter: sql.Where.Expr, } cols := sql.ColIndexes() s.Handler = whereFilter(s.filter, s, cols) return s }
go
func NewWhereFilter(ctx *plan.Context, sql *rel.SqlSelect) *Where { s := &Where{ TaskBase: NewTaskBase(ctx), filter: sql.Where.Expr, } cols := sql.ColIndexes() s.Handler = whereFilter(s.filter, s, cols) return s }
[ "func", "NewWhereFilter", "(", "ctx", "*", "plan", ".", "Context", ",", "sql", "*", "rel", ".", "SqlSelect", ")", "*", "Where", "{", "s", ":=", "&", "Where", "{", "TaskBase", ":", "NewTaskBase", "(", "ctx", ")", ",", "filter", ":", "sql", ".", "Whe...
// NewWhereFilter filters vs final differ bc the Final does final column aliasing
[ "NewWhereFilter", "filters", "vs", "final", "differ", "bc", "the", "Final", "does", "final", "column", "aliasing" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/where.go#L67-L75
20,567
araddon/qlbridge
value/coerce.go
Cast
func Cast(valType ValueType, val Value) (Value, error) { switch valType { case ByteSliceType: switch valt := val.(type) { case ByteSliceValue: return valt, nil default: return NewByteSliceValue([]byte(val.ToString())), nil } case TimeType: t, ok := ValueToTime(val) if ok { return NewTimeValue(t...
go
func Cast(valType ValueType, val Value) (Value, error) { switch valType { case ByteSliceType: switch valt := val.(type) { case ByteSliceValue: return valt, nil default: return NewByteSliceValue([]byte(val.ToString())), nil } case TimeType: t, ok := ValueToTime(val) if ok { return NewTimeValue(t...
[ "func", "Cast", "(", "valType", "ValueType", ",", "val", "Value", ")", "(", "Value", ",", "error", ")", "{", "switch", "valType", "{", "case", "ByteSliceType", ":", "switch", "valt", ":=", "val", ".", "(", "type", ")", "{", "case", "ByteSliceValue", ":...
// Cast a value to given value type
[ "Cast", "a", "value", "to", "given", "value", "type" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/value/coerce.go#L71-L96
20,568
araddon/qlbridge
value/coerce.go
Equal
func Equal(l, r Value) (bool, error) { if l == nil && r == nil { return true, nil } if r == nil { switch l.(type) { case NilValue: return true, nil } return false, nil } if _, isNil := r.(NilValue); isNil { switch l.(type) { case nil: return true, nil case NilValue: return true, nil } ...
go
func Equal(l, r Value) (bool, error) { if l == nil && r == nil { return true, nil } if r == nil { switch l.(type) { case NilValue: return true, nil } return false, nil } if _, isNil := r.(NilValue); isNil { switch l.(type) { case nil: return true, nil case NilValue: return true, nil } ...
[ "func", "Equal", "(", "l", ",", "r", "Value", ")", "(", "bool", ",", "error", ")", "{", "if", "l", "==", "nil", "&&", "r", "==", "nil", "{", "return", "true", ",", "nil", "\n", "}", "\n\n", "if", "r", "==", "nil", "{", "switch", "l", ".", "...
// Equal function compares equality after detecting type. // error if it could not evaluate
[ "Equal", "function", "compares", "equality", "after", "detecting", "type", ".", "error", "if", "it", "could", "not", "evaluate" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/value/coerce.go#L100-L158
20,569
araddon/qlbridge
value/coerce.go
ValueToString
func ValueToString(val Value) (string, bool) { if val == nil || val.Err() { return "", false } switch v := val.(type) { case StringValue: return v.Val(), true case TimeValue: return fmt.Sprintf("%v", v.Val()), true case ByteSliceValue: return string(v.Val()), true case NumericValue, BoolValue, IntValue: ...
go
func ValueToString(val Value) (string, bool) { if val == nil || val.Err() { return "", false } switch v := val.(type) { case StringValue: return v.Val(), true case TimeValue: return fmt.Sprintf("%v", v.Val()), true case ByteSliceValue: return string(v.Val()), true case NumericValue, BoolValue, IntValue: ...
[ "func", "ValueToString", "(", "val", "Value", ")", "(", "string", ",", "bool", ")", "{", "if", "val", "==", "nil", "||", "val", ".", "Err", "(", ")", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "switch", "v", ":=", "val", ".", "("...
// ValueToString convert all scalar values to their go string.
[ "ValueToString", "convert", "all", "scalar", "values", "to", "their", "go", "string", "." ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/value/coerce.go#L161-L194
20,570
araddon/qlbridge
value/coerce.go
IsBool
func IsBool(sv string) bool { _, err := strconv.ParseBool(sv) if err == nil { return true } return false }
go
func IsBool(sv string) bool { _, err := strconv.ParseBool(sv) if err == nil { return true } return false }
[ "func", "IsBool", "(", "sv", "string", ")", "bool", "{", "_", ",", "err", ":=", "strconv", ".", "ParseBool", "(", "sv", ")", "\n", "if", "err", "==", "nil", "{", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}" ]
// is this boolean string?
[ "is", "this", "boolean", "string?" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/value/coerce.go#L226-L232
20,571
araddon/qlbridge
value/coerce.go
ValueToBool
func ValueToBool(val Value) (bool, bool) { if val == nil || val.Nil() || val.Err() { return false, false } switch v := val.(type) { case NumericValue: iv := v.Int() if iv == 0 { return false, true } else if iv == 1 { return true, true } else { return false, false } case StringValue: bv, err ...
go
func ValueToBool(val Value) (bool, bool) { if val == nil || val.Nil() || val.Err() { return false, false } switch v := val.(type) { case NumericValue: iv := v.Int() if iv == 0 { return false, true } else if iv == 1 { return true, true } else { return false, false } case StringValue: bv, err ...
[ "func", "ValueToBool", "(", "val", "Value", ")", "(", "bool", ",", "bool", ")", "{", "if", "val", "==", "nil", "||", "val", ".", "Nil", "(", ")", "||", "val", ".", "Err", "(", ")", "{", "return", "false", ",", "false", "\n", "}", "\n", "switch"...
// ValueToBool Convert a value type to a bool if possible
[ "ValueToBool", "Convert", "a", "value", "type", "to", "a", "bool", "if", "possible" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/value/coerce.go#L243-L267
20,572
araddon/qlbridge
value/coerce.go
ValueToFloat64
func ValueToFloat64(val Value) (float64, bool) { if val == nil || val.Nil() || val.Err() { return math.NaN(), false } switch v := val.(type) { case NumericValue: return v.Float(), true case StringValue: return StringToFloat64(v.Val()) case BoolValue: // Should we co-erce bools to 0/1? if v.Val() { re...
go
func ValueToFloat64(val Value) (float64, bool) { if val == nil || val.Nil() || val.Err() { return math.NaN(), false } switch v := val.(type) { case NumericValue: return v.Float(), true case StringValue: return StringToFloat64(v.Val()) case BoolValue: // Should we co-erce bools to 0/1? if v.Val() { re...
[ "func", "ValueToFloat64", "(", "val", "Value", ")", "(", "float64", ",", "bool", ")", "{", "if", "val", "==", "nil", "||", "val", ".", "Nil", "(", ")", "||", "val", ".", "Err", "(", ")", "{", "return", "math", ".", "NaN", "(", ")", ",", "false"...
// ValueToFloat64 Convert a value type to a float64 if possible
[ "ValueToFloat64", "Convert", "a", "value", "type", "to", "a", "float64", "if", "possible" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/value/coerce.go#L270-L287
20,573
araddon/qlbridge
value/coerce.go
ValueToInt
func ValueToInt(val Value) (int, bool) { iv, ok := ValueToInt64(val) return int(iv), ok }
go
func ValueToInt(val Value) (int, bool) { iv, ok := ValueToInt64(val) return int(iv), ok }
[ "func", "ValueToInt", "(", "val", "Value", ")", "(", "int", ",", "bool", ")", "{", "iv", ",", "ok", ":=", "ValueToInt64", "(", "val", ")", "\n", "return", "int", "(", "iv", ")", ",", "ok", "\n", "}" ]
// ValueToInt Convert a value type to a int if possible
[ "ValueToInt", "Convert", "a", "value", "type", "to", "a", "int", "if", "possible" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/value/coerce.go#L290-L293
20,574
araddon/qlbridge
value/coerce.go
ValueToInt64
func ValueToInt64(val Value) (int64, bool) { if val == nil || val.Nil() || val.Err() { return 0, false } switch v := val.(type) { case NumericValue: return v.Int(), true case StringValue: return convertStringToInt64(0, v.Val()) case Slice: if v.Len() > 0 { return ValueToInt64(v.SliceValue()[0]) } } ...
go
func ValueToInt64(val Value) (int64, bool) { if val == nil || val.Nil() || val.Err() { return 0, false } switch v := val.(type) { case NumericValue: return v.Int(), true case StringValue: return convertStringToInt64(0, v.Val()) case Slice: if v.Len() > 0 { return ValueToInt64(v.SliceValue()[0]) } } ...
[ "func", "ValueToInt64", "(", "val", "Value", ")", "(", "int64", ",", "bool", ")", "{", "if", "val", "==", "nil", "||", "val", ".", "Nil", "(", ")", "||", "val", ".", "Err", "(", ")", "{", "return", "0", ",", "false", "\n", "}", "\n", "switch", ...
// ValueToInt64 Convert a value type to a int64 if possible
[ "ValueToInt64", "Convert", "a", "value", "type", "to", "a", "int64", "if", "possible" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/value/coerce.go#L296-L311
20,575
araddon/qlbridge
value/coerce.go
StringToTimeAnchor
func StringToTimeAnchor(val string, anchor time.Time) (time.Time, bool) { if len(val) > 3 && strings.ToLower(val[:3]) == "now" { // Is date math t, err := datemath.EvalAnchor(anchor, val) if err != nil { return time.Time{}, false } return t, true } t, err := dateparse.ParseAny(val) if err == nil { r...
go
func StringToTimeAnchor(val string, anchor time.Time) (time.Time, bool) { if len(val) > 3 && strings.ToLower(val[:3]) == "now" { // Is date math t, err := datemath.EvalAnchor(anchor, val) if err != nil { return time.Time{}, false } return t, true } t, err := dateparse.ParseAny(val) if err == nil { r...
[ "func", "StringToTimeAnchor", "(", "val", "string", ",", "anchor", "time", ".", "Time", ")", "(", "time", ".", "Time", ",", "bool", ")", "{", "if", "len", "(", "val", ")", ">", "3", "&&", "strings", ".", "ToLower", "(", "val", "[", ":", "3", "]",...
// StringToTimeAnchor Convert a string type to a time if possible. // If "now-3d" then use date-anchoring ie if prefix = 'now'.
[ "StringToTimeAnchor", "Convert", "a", "string", "type", "to", "a", "time", "if", "possible", ".", "If", "now", "-", "3d", "then", "use", "date", "-", "anchoring", "ie", "if", "prefix", "=", "now", "." ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/value/coerce.go#L315-L330
20,576
araddon/qlbridge
value/coerce.go
ValueToTime
func ValueToTime(val Value) (time.Time, bool) { return ValueToTimeAnchor(val, time.Now()) }
go
func ValueToTime(val Value) (time.Time, bool) { return ValueToTimeAnchor(val, time.Now()) }
[ "func", "ValueToTime", "(", "val", "Value", ")", "(", "time", ".", "Time", ",", "bool", ")", "{", "return", "ValueToTimeAnchor", "(", "val", ",", "time", ".", "Now", "(", ")", ")", "\n", "}" ]
// ValueToTime Convert a value type to a time if possible
[ "ValueToTime", "Convert", "a", "value", "type", "to", "a", "time", "if", "possible" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/value/coerce.go#L333-L335
20,577
araddon/qlbridge
value/coerce.go
ValueToTimeAnchor
func ValueToTimeAnchor(val Value, anchor time.Time) (time.Time, bool) { switch v := val.(type) { case TimeValue: return v.Val(), true case StringValue: return StringToTimeAnchor(v.Val(), anchor) case StringsValue: vals := v.Val() if len(vals) < 1 { return time.Time{}, false } return StringToTimeAncho...
go
func ValueToTimeAnchor(val Value, anchor time.Time) (time.Time, bool) { switch v := val.(type) { case TimeValue: return v.Val(), true case StringValue: return StringToTimeAnchor(v.Val(), anchor) case StringsValue: vals := v.Val() if len(vals) < 1 { return time.Time{}, false } return StringToTimeAncho...
[ "func", "ValueToTimeAnchor", "(", "val", "Value", ",", "anchor", "time", ".", "Time", ")", "(", "time", ".", "Time", ",", "bool", ")", "{", "switch", "v", ":=", "val", ".", "(", "type", ")", "{", "case", "TimeValue", ":", "return", "v", ".", "Val",...
// ValueToTimeAnchor given a value, and a time anchor, conver to time. // use "now-3d" anchoring if has prefix "now".
[ "ValueToTimeAnchor", "given", "a", "value", "and", "a", "time", "anchor", "conver", "to", "time", ".", "use", "now", "-", "3d", "anchoring", "if", "has", "prefix", "now", "." ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/value/coerce.go#L339-L364
20,578
araddon/qlbridge
exec/mutations.go
NewInsert
func NewInsert(ctx *plan.Context, p *plan.Insert) *Upsert { m := &Upsert{ TaskBase: NewTaskBase(ctx), db: p.Source, insert: p.Stmt, } return m }
go
func NewInsert(ctx *plan.Context, p *plan.Insert) *Upsert { m := &Upsert{ TaskBase: NewTaskBase(ctx), db: p.Source, insert: p.Stmt, } return m }
[ "func", "NewInsert", "(", "ctx", "*", "plan", ".", "Context", ",", "p", "*", "plan", ".", "Insert", ")", "*", "Upsert", "{", "m", ":=", "&", "Upsert", "{", "TaskBase", ":", "NewTaskBase", "(", "ctx", ")", ",", "db", ":", "p", ".", "Source", ",", ...
// An insert to write to data source
[ "An", "insert", "to", "write", "to", "data", "source" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/mutations.go#L51-L58
20,579
araddon/qlbridge
exec/mutations.go
NewDelete
func NewDelete(ctx *plan.Context, p *plan.Delete) *DeletionTask { m := &DeletionTask{ TaskBase: NewTaskBase(ctx), db: p.Source, sql: p.Stmt, p: p, } return m }
go
func NewDelete(ctx *plan.Context, p *plan.Delete) *DeletionTask { m := &DeletionTask{ TaskBase: NewTaskBase(ctx), db: p.Source, sql: p.Stmt, p: p, } return m }
[ "func", "NewDelete", "(", "ctx", "*", "plan", ".", "Context", ",", "p", "*", "plan", ".", "Delete", ")", "*", "DeletionTask", "{", "m", ":=", "&", "DeletionTask", "{", "TaskBase", ":", "NewTaskBase", "(", "ctx", ")", ",", "db", ":", "p", ".", "Sour...
// An inserter to write to data source
[ "An", "inserter", "to", "write", "to", "data", "source" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/exec/mutations.go#L77-L85
20,580
araddon/qlbridge
expr/builtins/math.go
Validate
func (m *Sqrt) Validate(n *expr.FuncNode) (expr.EvaluatorFunc, error) { if len(n.Args) != 1 { return nil, fmt.Errorf("Expected exactly 1 args for sqrt(arg) but got %s", n) } return sqrtEval, nil }
go
func (m *Sqrt) Validate(n *expr.FuncNode) (expr.EvaluatorFunc, error) { if len(n.Args) != 1 { return nil, fmt.Errorf("Expected exactly 1 args for sqrt(arg) but got %s", n) } return sqrtEval, nil }
[ "func", "(", "m", "*", "Sqrt", ")", "Validate", "(", "n", "*", "expr", ".", "FuncNode", ")", "(", "expr", ".", "EvaluatorFunc", ",", "error", ")", "{", "if", "len", "(", "n", ".", "Args", ")", "!=", "1", "{", "return", "nil", ",", "fmt", ".", ...
// Validate Must have 1 arg
[ "Validate", "Must", "have", "1", "arg" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/expr/builtins/math.go#L23-L28
20,581
araddon/qlbridge
expr/builtins/math.go
Validate
func (m *Pow) Validate(n *expr.FuncNode) (expr.EvaluatorFunc, error) { if len(n.Args) != 2 { return nil, fmt.Errorf("Expected 2 args for Pow(numer, power) but got %s", n) } return powerEval, nil }
go
func (m *Pow) Validate(n *expr.FuncNode) (expr.EvaluatorFunc, error) { if len(n.Args) != 2 { return nil, fmt.Errorf("Expected 2 args for Pow(numer, power) but got %s", n) } return powerEval, nil }
[ "func", "(", "m", "*", "Pow", ")", "Validate", "(", "n", "*", "expr", ".", "FuncNode", ")", "(", "expr", ".", "EvaluatorFunc", ",", "error", ")", "{", "if", "len", "(", "n", ".", "Args", ")", "!=", "2", "{", "return", "nil", ",", "fmt", ".", ...
// Must have 2 arguments, both must be able to be coerced to Number
[ "Must", "have", "2", "arguments", "both", "must", "be", "able", "to", "be", "coerced", "to", "Number" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/expr/builtins/math.go#L57-L62
20,582
araddon/qlbridge
datasource/sqlite/schemawriter.go
TableToString
func TableToString(tbl *schema.Table) string { w := &bytes.Buffer{} //u.Infof("%s tbl=%p fields? %#v fields?%v", tbl.Name, tbl, tbl.FieldMap, len(tbl.Fields)) fmt.Fprintf(w, "CREATE TABLE `%s` (", tbl.Name) for i, fld := range tbl.Fields { if i != 0 { w.WriteByte(',') } fmt.Fprint(w, "\n ") WriteFiel...
go
func TableToString(tbl *schema.Table) string { w := &bytes.Buffer{} //u.Infof("%s tbl=%p fields? %#v fields?%v", tbl.Name, tbl, tbl.FieldMap, len(tbl.Fields)) fmt.Fprintf(w, "CREATE TABLE `%s` (", tbl.Name) for i, fld := range tbl.Fields { if i != 0 { w.WriteByte(',') } fmt.Fprint(w, "\n ") WriteFiel...
[ "func", "TableToString", "(", "tbl", "*", "schema", ".", "Table", ")", "string", "{", "w", ":=", "&", "bytes", ".", "Buffer", "{", "}", "\n", "//u.Infof(\"%s tbl=%p fields? %#v fields?%v\", tbl.Name, tbl, tbl.FieldMap, len(tbl.Fields))", "fmt", ".", "Fprintf", "(", ...
// TableToString Table output a CREATE TABLE statement using mysql dialect.
[ "TableToString", "Table", "output", "a", "CREATE", "TABLE", "statement", "using", "mysql", "dialect", "." ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/sqlite/schemawriter.go#L44-L60
20,583
araddon/qlbridge
datasource/sqlite/schemawriter.go
TypeFromString
func TypeFromString(t string) value.ValueType { switch strings.ToLower(t) { case "integer": // This isn't necessarily true, as integer could be bool return value.IntType case "real": return value.NumberType default: return value.StringType } }
go
func TypeFromString(t string) value.ValueType { switch strings.ToLower(t) { case "integer": // This isn't necessarily true, as integer could be bool return value.IntType case "real": return value.NumberType default: return value.StringType } }
[ "func", "TypeFromString", "(", "t", "string", ")", "value", ".", "ValueType", "{", "switch", "strings", ".", "ToLower", "(", "t", ")", "{", "case", "\"", "\"", ":", "// This isn't necessarily true, as integer could be bool", "return", "value", ".", "IntType", "\...
// TypeFromString given a string, return data type
[ "TypeFromString", "given", "a", "string", "return", "data", "type" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/sqlite/schemawriter.go#L97-L107
20,584
araddon/qlbridge
datasource/files/filepager.go
NewFilePager
func NewFilePager(tableName string, fs *FileSource) *FilePager { fp := &FilePager{ fs: fs, table: tableName, exit: make(chan bool), readers: make(chan *FileReader, FileBufferSize), partid: -1, } return fp }
go
func NewFilePager(tableName string, fs *FileSource) *FilePager { fp := &FilePager{ fs: fs, table: tableName, exit: make(chan bool), readers: make(chan *FileReader, FileBufferSize), partid: -1, } return fp }
[ "func", "NewFilePager", "(", "tableName", "string", ",", "fs", "*", "FileSource", ")", "*", "FilePager", "{", "fp", ":=", "&", "FilePager", "{", "fs", ":", "fs", ",", "table", ":", "tableName", ",", "exit", ":", "make", "(", "chan", "bool", ")", ",",...
// NewFilePager creates default new FilePager
[ "NewFilePager", "creates", "default", "new", "FilePager" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/files/filepager.go#L50-L59
20,585
araddon/qlbridge
datasource/files/filepager.go
WalkExecSource
func (m *FilePager) WalkExecSource(p *plan.Source) (exec.Task, error) { if m.p == nil { m.p = p if partitionId, ok := p.Custom.IntSafe("partition"); ok { m.partid = partitionId } } return exec.NewSource(p.Context(), p) }
go
func (m *FilePager) WalkExecSource(p *plan.Source) (exec.Task, error) { if m.p == nil { m.p = p if partitionId, ok := p.Custom.IntSafe("partition"); ok { m.partid = partitionId } } return exec.NewSource(p.Context(), p) }
[ "func", "(", "m", "*", "FilePager", ")", "WalkExecSource", "(", "p", "*", "plan", ".", "Source", ")", "(", "exec", ".", "Task", ",", "error", ")", "{", "if", "m", ".", "p", "==", "nil", "{", "m", ".", "p", "=", "p", "\n", "if", "partitionId", ...
// WalkExecSource Provide ability to implement a source plan for execution
[ "WalkExecSource", "Provide", "ability", "to", "implement", "a", "source", "plan", "for", "execution" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/files/filepager.go#L62-L72
20,586
araddon/qlbridge
datasource/files/filepager.go
NextScanner
func (m *FilePager) NextScanner() (schema.ConnScanner, error) { fr, err := m.NextFile() if err == iterator.Done { return nil, err } else if err != nil { u.Warnf("NextFile Error %v", err) return nil, err } scanner, err := m.fs.fh.Scanner(m.fs.store, fr) if err != nil { u.Errorf("Could not open file scann...
go
func (m *FilePager) NextScanner() (schema.ConnScanner, error) { fr, err := m.NextFile() if err == iterator.Done { return nil, err } else if err != nil { u.Warnf("NextFile Error %v", err) return nil, err } scanner, err := m.fs.fh.Scanner(m.fs.store, fr) if err != nil { u.Errorf("Could not open file scann...
[ "func", "(", "m", "*", "FilePager", ")", "NextScanner", "(", ")", "(", "schema", ".", "ConnScanner", ",", "error", ")", "{", "fr", ",", "err", ":=", "m", ".", "NextFile", "(", ")", "\n", "if", "err", "==", "iterator", ".", "Done", "{", "return", ...
// NextScanner provides the next scanner assuming that each scanner // represents different file, and multiple files for single source
[ "NextScanner", "provides", "the", "next", "scanner", "assuming", "that", "each", "scanner", "represents", "different", "file", "and", "multiple", "files", "for", "single", "source" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/files/filepager.go#L89-L106
20,587
araddon/qlbridge
datasource/files/filepager.go
NextFile
func (m *FilePager) NextFile() (*FileReader, error) { select { case <-m.exit: // See if exit was called return nil, iterator.Done case fr := <-m.readers: if fr == nil { return nil, iterator.Done } return fr, nil } }
go
func (m *FilePager) NextFile() (*FileReader, error) { select { case <-m.exit: // See if exit was called return nil, iterator.Done case fr := <-m.readers: if fr == nil { return nil, iterator.Done } return fr, nil } }
[ "func", "(", "m", "*", "FilePager", ")", "NextFile", "(", ")", "(", "*", "FileReader", ",", "error", ")", "{", "select", "{", "case", "<-", "m", ".", "exit", ":", "// See if exit was called", "return", "nil", ",", "iterator", ".", "Done", "\n", "case",...
// NextFile gets next file
[ "NextFile", "gets", "next", "file" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/files/filepager.go#L109-L121
20,588
araddon/qlbridge
datasource/files/filepager.go
Next
func (m *FilePager) Next() schema.Message { if m.ConnScanner == nil { m.NextScanner() } for { if m.closed { return nil } else if m.ConnScanner == nil { m.closed = true return nil } msg := m.ConnScanner.Next() if msg == nil { // Kind of crap api, side-effect method? uck _, err := m.NextScan...
go
func (m *FilePager) Next() schema.Message { if m.ConnScanner == nil { m.NextScanner() } for { if m.closed { return nil } else if m.ConnScanner == nil { m.closed = true return nil } msg := m.ConnScanner.Next() if msg == nil { // Kind of crap api, side-effect method? uck _, err := m.NextScan...
[ "func", "(", "m", "*", "FilePager", ")", "Next", "(", ")", "schema", ".", "Message", "{", "if", "m", ".", "ConnScanner", "==", "nil", "{", "m", ".", "NextScanner", "(", ")", "\n", "}", "\n", "for", "{", "if", "m", ".", "closed", "{", "return", ...
// Next iterator for next message, wraps the file Scanner, Next file abstractions
[ "Next", "iterator", "for", "next", "message", "wraps", "the", "file", "Scanner", "Next", "file", "abstractions" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/datasource/files/filepager.go#L243-L278
20,589
araddon/qlbridge
lex/dialect.go
Init
func (m *Dialect) Init() { if m.inited { return } m.inited = true for _, s := range m.Statements { s.init() } }
go
func (m *Dialect) Init() { if m.inited { return } m.inited = true for _, s := range m.Statements { s.init() } }
[ "func", "(", "m", "*", "Dialect", ")", "Init", "(", ")", "{", "if", "m", ".", "inited", "{", "return", "\n", "}", "\n", "m", ".", "inited", "=", "true", "\n", "for", "_", ",", "s", ":=", "range", "m", ".", "Statements", "{", "s", ".", "init",...
// Init Dialects have one time load-setup.
[ "Init", "Dialects", "have", "one", "time", "load", "-", "setup", "." ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/lex/dialect.go#L39-L47
20,590
araddon/qlbridge
plan/planner_select.go
WalkProjectionFinal
func (m *PlannerDefault) WalkProjectionFinal(p *Select) error { // Add a Final Projection to choose the columns for results proj, err := NewProjectionFinal(m.Ctx, p) //u.Infof("Projection: %T:%p %T:%p", proj, proj, proj.Proj, proj.Proj) if err != nil { return err } p.Add(proj) if m.Ctx.Projection == nil { ...
go
func (m *PlannerDefault) WalkProjectionFinal(p *Select) error { // Add a Final Projection to choose the columns for results proj, err := NewProjectionFinal(m.Ctx, p) //u.Infof("Projection: %T:%p %T:%p", proj, proj, proj.Proj, proj.Proj) if err != nil { return err } p.Add(proj) if m.Ctx.Projection == nil { ...
[ "func", "(", "m", "*", "PlannerDefault", ")", "WalkProjectionFinal", "(", "p", "*", "Select", ")", "error", "{", "// Add a Final Projection to choose the columns for results", "proj", ",", "err", ":=", "NewProjectionFinal", "(", "m", ".", "Ctx", ",", "p", ")", "...
// WalkProjectionFinal walk the select plan to create final projection.
[ "WalkProjectionFinal", "walk", "the", "select", "plan", "to", "create", "final", "projection", "." ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/plan/planner_select.go#L144-L158
20,591
araddon/qlbridge
plan/planner_select.go
WalkSourceSelect
func (m *PlannerDefault) WalkSourceSelect(p *Source) error { if p.Stmt.Source != nil { //u.Debugf("%p VisitSubselect from.source = %q", p, p.Stmt.Source) } else { //u.Debugf("%p VisitSubselect from=%q", p, p) } // All of this is plan info, ie needs JoinKey needsJoinKey := false if p.Stmt.Source != nil && le...
go
func (m *PlannerDefault) WalkSourceSelect(p *Source) error { if p.Stmt.Source != nil { //u.Debugf("%p VisitSubselect from.source = %q", p, p.Stmt.Source) } else { //u.Debugf("%p VisitSubselect from=%q", p, p) } // All of this is plan info, ie needs JoinKey needsJoinKey := false if p.Stmt.Source != nil && le...
[ "func", "(", "m", "*", "PlannerDefault", ")", "WalkSourceSelect", "(", "p", "*", "Source", ")", "error", "{", "if", "p", ".", "Stmt", ".", "Source", "!=", "nil", "{", "//u.Debugf(\"%p VisitSubselect from.source = %q\", p, p.Stmt.Source)", "}", "else", "{", "//u....
// WalkSourceSelect is a single source select
[ "WalkSourceSelect", "is", "a", "single", "source", "select" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/plan/planner_select.go#L171-L253
20,592
araddon/qlbridge
plan/planner_select.go
WalkLiteralQuery
func (m *PlannerDefault) WalkLiteralQuery(p *Select) error { //u.Debugf("WalkLiteralQuery %+v", p.Stmt) // Must project and possibly where if p.Stmt.Where != nil { u.Warnf("select literal where not implemented") // the reason this is wrong is that the Source task gets // added in the WalkProjectionFinal below...
go
func (m *PlannerDefault) WalkLiteralQuery(p *Select) error { //u.Debugf("WalkLiteralQuery %+v", p.Stmt) // Must project and possibly where if p.Stmt.Where != nil { u.Warnf("select literal where not implemented") // the reason this is wrong is that the Source task gets // added in the WalkProjectionFinal below...
[ "func", "(", "m", "*", "PlannerDefault", ")", "WalkLiteralQuery", "(", "p", "*", "Select", ")", "error", "{", "//u.Debugf(\"WalkLiteralQuery %+v\", p.Stmt)", "// Must project and possibly where", "if", "p", ".", "Stmt", ".", "Where", "!=", "nil", "{", "u", ".", ...
// WalkLiteralQuery Handle Literal queries such as "SELECT 1, @var;"
[ "WalkLiteralQuery", "Handle", "Literal", "queries", "such", "as", "SELECT", "1" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/plan/planner_select.go#L267-L286
20,593
araddon/qlbridge
rel/sql.go
SourceName
func (m *ResultColumn) SourceName() string { if m.Col != nil && m.Col.SourceField != "" { return m.Col.SourceField } return m.Name }
go
func (m *ResultColumn) SourceName() string { if m.Col != nil && m.Col.SourceField != "" { return m.Col.SourceField } return m.Name }
[ "func", "(", "m", "*", "ResultColumn", ")", "SourceName", "(", ")", "string", "{", "if", "m", ".", "Col", "!=", "nil", "&&", "m", ".", "Col", ".", "SourceField", "!=", "\"", "\"", "{", "return", "m", ".", "Col", ".", "SourceField", "\n", "}", "\n...
// The source column name
[ "The", "source", "column", "name" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/sql.go#L401-L406
20,594
araddon/qlbridge
rel/sql.go
CopyRewrite
func (m *Column) CopyRewrite(alias string) *Column { left, right, _ := m.LeftRight() newCol := m.Copy() //u.Warnf("in rewrite: Alias:'%s' '%s'.'%s' sourcefield:'%v'", alias, left, right, m.SourceField) if left == alias { newCol.SourceField = right newCol.right = right } if newCol.Expr != nil { _, right, ...
go
func (m *Column) CopyRewrite(alias string) *Column { left, right, _ := m.LeftRight() newCol := m.Copy() //u.Warnf("in rewrite: Alias:'%s' '%s'.'%s' sourcefield:'%v'", alias, left, right, m.SourceField) if left == alias { newCol.SourceField = right newCol.right = right } if newCol.Expr != nil { _, right, ...
[ "func", "(", "m", "*", "Column", ")", "CopyRewrite", "(", "alias", "string", ")", "*", "Column", "{", "left", ",", "right", ",", "_", ":=", "m", ".", "LeftRight", "(", ")", "\n", "newCol", ":=", "m", ".", "Copy", "(", ")", "\n", "//u.Warnf(\"in rew...
// CopyRewrite Create a new copy of this column for rewrite purposes removing alias
[ "CopyRewrite", "Create", "a", "new", "copy", "of", "this", "column", "for", "rewrite", "purposes", "removing", "alias" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/sql.go#L812-L827
20,595
araddon/qlbridge
rel/sql.go
Copy
func (m *Column) Copy() *Column { return &Column{ sourceQuoteByte: m.sourceQuoteByte, asQuoteByte: m.asQuoteByte, originalAs: m.originalAs, ParentIndex: m.ParentIndex, Index: m.Index, SourceField: m.SourceField, As: m.right, Comment: m.Comment, Order: ...
go
func (m *Column) Copy() *Column { return &Column{ sourceQuoteByte: m.sourceQuoteByte, asQuoteByte: m.asQuoteByte, originalAs: m.originalAs, ParentIndex: m.ParentIndex, Index: m.Index, SourceField: m.SourceField, As: m.right, Comment: m.Comment, Order: ...
[ "func", "(", "m", "*", "Column", ")", "Copy", "(", ")", "*", "Column", "{", "return", "&", "Column", "{", "sourceQuoteByte", ":", "m", ".", "sourceQuoteByte", ",", "asQuoteByte", ":", "m", ".", "asQuoteByte", ",", "originalAs", ":", "m", ".", "original...
// Copy - deep copy, shared nothing
[ "Copy", "-", "deep", "copy", "shared", "nothing" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/sql.go#L830-L845
20,596
araddon/qlbridge
rel/sql.go
SqlSelectFromPb
func SqlSelectFromPb(pb *SqlSelectPb) *SqlSelect { ss := SqlSelect{ Db: pb.GetDb(), Raw: pb.GetRaw(), Star: pb.GetStar(), Distinct: pb.GetDistinct(), Alias: pb.GetAlias(), Limit: int(pb.GetLimit()), Offset: int(pb.GetOffset()), isAgg: pb.GetIsAgg(), finalized: pb.Get...
go
func SqlSelectFromPb(pb *SqlSelectPb) *SqlSelect { ss := SqlSelect{ Db: pb.GetDb(), Raw: pb.GetRaw(), Star: pb.GetStar(), Distinct: pb.GetDistinct(), Alias: pb.GetAlias(), Limit: int(pb.GetLimit()), Offset: int(pb.GetOffset()), isAgg: pb.GetIsAgg(), finalized: pb.Get...
[ "func", "SqlSelectFromPb", "(", "pb", "*", "SqlSelectPb", ")", "*", "SqlSelect", "{", "ss", ":=", "SqlSelect", "{", "Db", ":", "pb", ".", "GetDb", "(", ")", ",", "Raw", ":", "pb", ".", "GetRaw", "(", ")", ",", "Star", ":", "pb", ".", "GetStar", "...
// SqlSelectFromPb take a protobuf select struct and conver to SqlSelect
[ "SqlSelectFromPb", "take", "a", "protobuf", "select", "struct", "and", "conver", "to", "SqlSelect" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/sql.go#L1095-L1140
20,597
araddon/qlbridge
rel/sql.go
Finalize
func (m *SqlSelect) Finalize() error { if m.finalized { return nil } m.finalized = true if len(m.From) == 0 { return nil } for _, from := range m.From { from.Finalize() } return nil }
go
func (m *SqlSelect) Finalize() error { if m.finalized { return nil } m.finalized = true if len(m.From) == 0 { return nil } for _, from := range m.From { from.Finalize() } return nil }
[ "func", "(", "m", "*", "SqlSelect", ")", "Finalize", "(", ")", "error", "{", "if", "m", ".", "finalized", "{", "return", "nil", "\n", "}", "\n", "m", ".", "finalized", "=", "true", "\n", "if", "len", "(", "m", ".", "From", ")", "==", "0", "{", ...
// Finalize this Query plan by preparing sub-sources // ie we need to rewrite some things into sub-statements // - we need to share the join expression across sources
[ "Finalize", "this", "Query", "plan", "by", "preparing", "sub", "-", "sources", "ie", "we", "need", "to", "rewrite", "some", "things", "into", "sub", "-", "statements", "-", "we", "need", "to", "share", "the", "join", "expression", "across", "sources" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/sql.go#L1220-L1233
20,598
araddon/qlbridge
rel/sql.go
Rewrite
func (m *SqlSelect) Rewrite() { for _, f := range m.From { f.Rewrite(m) } }
go
func (m *SqlSelect) Rewrite() { for _, f := range m.From { f.Rewrite(m) } }
[ "func", "(", "m", "*", "SqlSelect", ")", "Rewrite", "(", ")", "{", "for", "_", ",", "f", ":=", "range", "m", ".", "From", "{", "f", ".", "Rewrite", "(", "m", ")", "\n", "}", "\n", "}" ]
// Rewrite take current SqlSelect statement and re-write it
[ "Rewrite", "take", "current", "SqlSelect", "statement", "and", "re", "-", "write", "it" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/sql.go#L1298-L1302
20,599
araddon/qlbridge
rel/sql.go
UnAliasedColumns
func (m *SqlSource) UnAliasedColumns() map[string]*Column { //u.Warnf("un-aliased %d", len(m.Source.Columns)) if len(m.cols) > 0 || m.Source != nil && len(m.Source.Columns) == 0 { return m.cols } cols := make(map[string]*Column, len(m.Source.Columns)) for _, col := range m.Source.Columns { _, right, hasLeft :...
go
func (m *SqlSource) UnAliasedColumns() map[string]*Column { //u.Warnf("un-aliased %d", len(m.Source.Columns)) if len(m.cols) > 0 || m.Source != nil && len(m.Source.Columns) == 0 { return m.cols } cols := make(map[string]*Column, len(m.Source.Columns)) for _, col := range m.Source.Columns { _, right, hasLeft :...
[ "func", "(", "m", "*", "SqlSource", ")", "UnAliasedColumns", "(", ")", "map", "[", "string", "]", "*", "Column", "{", "//u.Warnf(\"un-aliased %d\", len(m.Source.Columns))", "if", "len", "(", "m", ".", "cols", ")", ">", "0", "||", "m", ".", "Source", "!=", ...
// Get a list of Un-Aliased Columns, ie columns with column // names that have NOT yet been aliased
[ "Get", "a", "list", "of", "Un", "-", "Aliased", "Columns", "ie", "columns", "with", "column", "names", "that", "have", "NOT", "yet", "been", "aliased" ]
23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac
https://github.com/araddon/qlbridge/blob/23bb6a4e8c9e82ba86952b8a1469ccff1bb296ac/rel/sql.go#L1458-L1475