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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
133,000 | influxdata/influxql | ast.go | RewriteTimeFields | func (s *SelectStatement) RewriteTimeFields() {
for i := 0; i < len(s.Fields); i++ {
switch expr := s.Fields[i].Expr.(type) {
case *VarRef:
if expr.Val == "time" {
s.TimeAlias = s.Fields[i].Alias
s.Fields = append(s.Fields[:i], s.Fields[i+1:]...)
}
}
}
} | go | func (s *SelectStatement) RewriteTimeFields() {
for i := 0; i < len(s.Fields); i++ {
switch expr := s.Fields[i].Expr.(type) {
case *VarRef:
if expr.Val == "time" {
s.TimeAlias = s.Fields[i].Alias
s.Fields = append(s.Fields[:i], s.Fields[i+1:]...)
}
}
}
} | [
"func",
"(",
"s",
"*",
"SelectStatement",
")",
"RewriteTimeFields",
"(",
")",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"s",
".",
"Fields",
")",
";",
"i",
"++",
"{",
"switch",
"expr",
":=",
"s",
".",
"Fields",
"[",
"i",
"]",
".",
... | // RewriteTimeFields removes any "time" field references. | [
"RewriteTimeFields",
"removes",
"any",
"time",
"field",
"references",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L1618-L1628 |
133,001 | influxdata/influxql | ast.go | ColumnNames | func (s *SelectStatement) ColumnNames() []string {
// First walk each field to determine the number of columns.
columnFields := Fields{}
for _, field := range s.Fields {
columnFields = append(columnFields, field)
switch f := field.Expr.(type) {
case *Call:
if s.Target == nil && (f.Name == "top" || f.Name =... | go | func (s *SelectStatement) ColumnNames() []string {
// First walk each field to determine the number of columns.
columnFields := Fields{}
for _, field := range s.Fields {
columnFields = append(columnFields, field)
switch f := field.Expr.(type) {
case *Call:
if s.Target == nil && (f.Name == "top" || f.Name =... | [
"func",
"(",
"s",
"*",
"SelectStatement",
")",
"ColumnNames",
"(",
")",
"[",
"]",
"string",
"{",
"// First walk each field to determine the number of columns.",
"columnFields",
":=",
"Fields",
"{",
"}",
"\n",
"for",
"_",
",",
"field",
":=",
"range",
"s",
".",
... | // ColumnNames will walk all fields and functions and return the appropriate field names for the select statement
// while maintaining order of the field names. | [
"ColumnNames",
"will",
"walk",
"all",
"fields",
"and",
"functions",
"and",
"return",
"the",
"appropriate",
"field",
"names",
"for",
"the",
"select",
"statement",
"while",
"maintaining",
"order",
"of",
"the",
"field",
"names",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L1632-L1698 |
133,002 | influxdata/influxql | ast.go | FieldExprByName | func (s *SelectStatement) FieldExprByName(name string) (int, Expr) {
for i, f := range s.Fields {
if f.Name() == name {
return i, f.Expr
} else if call, ok := f.Expr.(*Call); ok && (call.Name == "top" || call.Name == "bottom") && len(call.Args) > 2 {
for _, arg := range call.Args[1 : len(call.Args)-1] {
... | go | func (s *SelectStatement) FieldExprByName(name string) (int, Expr) {
for i, f := range s.Fields {
if f.Name() == name {
return i, f.Expr
} else if call, ok := f.Expr.(*Call); ok && (call.Name == "top" || call.Name == "bottom") && len(call.Args) > 2 {
for _, arg := range call.Args[1 : len(call.Args)-1] {
... | [
"func",
"(",
"s",
"*",
"SelectStatement",
")",
"FieldExprByName",
"(",
"name",
"string",
")",
"(",
"int",
",",
"Expr",
")",
"{",
"for",
"i",
",",
"f",
":=",
"range",
"s",
".",
"Fields",
"{",
"if",
"f",
".",
"Name",
"(",
")",
"==",
"name",
"{",
... | // FieldExprByName returns the expression that matches the field name and the
// index where this was found. If the name matches one of the arguments to
// "top" or "bottom", the variable reference inside of the function is returned
// and the index is of the function call rather than the variable reference.
// If no e... | [
"FieldExprByName",
"returns",
"the",
"expression",
"that",
"matches",
"the",
"field",
"name",
"and",
"the",
"index",
"where",
"this",
"was",
"found",
".",
"If",
"the",
"name",
"matches",
"one",
"of",
"the",
"arguments",
"to",
"top",
"or",
"bottom",
"the",
... | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L1706-L1719 |
133,003 | influxdata/influxql | ast.go | Reduce | func (s *SelectStatement) Reduce(valuer Valuer) *SelectStatement {
stmt := s.Clone()
stmt.Condition = Reduce(stmt.Condition, valuer)
for _, d := range stmt.Dimensions {
d.Expr = Reduce(d.Expr, valuer)
}
for _, source := range stmt.Sources {
switch source := source.(type) {
case *SubQuery:
source.Statemen... | go | func (s *SelectStatement) Reduce(valuer Valuer) *SelectStatement {
stmt := s.Clone()
stmt.Condition = Reduce(stmt.Condition, valuer)
for _, d := range stmt.Dimensions {
d.Expr = Reduce(d.Expr, valuer)
}
for _, source := range stmt.Sources {
switch source := source.(type) {
case *SubQuery:
source.Statemen... | [
"func",
"(",
"s",
"*",
"SelectStatement",
")",
"Reduce",
"(",
"valuer",
"Valuer",
")",
"*",
"SelectStatement",
"{",
"stmt",
":=",
"s",
".",
"Clone",
"(",
")",
"\n",
"stmt",
".",
"Condition",
"=",
"Reduce",
"(",
"stmt",
".",
"Condition",
",",
"valuer",
... | // Reduce calls the Reduce function on the different components of the
// SelectStatement to reduce the statement. | [
"Reduce",
"calls",
"the",
"Reduce",
"function",
"on",
"the",
"different",
"components",
"of",
"the",
"SelectStatement",
"to",
"reduce",
"the",
"statement",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L1723-L1737 |
133,004 | influxdata/influxql | ast.go | String | func (s *SelectStatement) String() string {
var buf bytes.Buffer
_, _ = buf.WriteString("SELECT ")
_, _ = buf.WriteString(s.Fields.String())
if s.Target != nil {
_, _ = buf.WriteString(" ")
_, _ = buf.WriteString(s.Target.String())
}
if len(s.Sources) > 0 {
_, _ = buf.WriteString(" FROM ")
_, _ = buf.Wri... | go | func (s *SelectStatement) String() string {
var buf bytes.Buffer
_, _ = buf.WriteString("SELECT ")
_, _ = buf.WriteString(s.Fields.String())
if s.Target != nil {
_, _ = buf.WriteString(" ")
_, _ = buf.WriteString(s.Target.String())
}
if len(s.Sources) > 0 {
_, _ = buf.WriteString(" FROM ")
_, _ = buf.Wri... | [
"func",
"(",
"s",
"*",
"SelectStatement",
")",
"String",
"(",
")",
"string",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"_",
",",
"_",
"=",
"buf",
".",
"WriteString",
"(",
"\"",
"\"",
")",
"\n",
"_",
",",
"_",
"=",
"buf",
".",
"WriteString"... | // String returns a string representation of the select statement. | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"select",
"statement",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L1740-L1792 |
133,005 | influxdata/influxql | ast.go | HasFieldWildcard | func (s *SelectStatement) HasFieldWildcard() (hasWildcard bool) {
WalkFunc(s.Fields, func(n Node) {
if hasWildcard {
return
}
switch n.(type) {
case *Wildcard, *RegexLiteral:
hasWildcard = true
}
})
return hasWildcard
} | go | func (s *SelectStatement) HasFieldWildcard() (hasWildcard bool) {
WalkFunc(s.Fields, func(n Node) {
if hasWildcard {
return
}
switch n.(type) {
case *Wildcard, *RegexLiteral:
hasWildcard = true
}
})
return hasWildcard
} | [
"func",
"(",
"s",
"*",
"SelectStatement",
")",
"HasFieldWildcard",
"(",
")",
"(",
"hasWildcard",
"bool",
")",
"{",
"WalkFunc",
"(",
"s",
".",
"Fields",
",",
"func",
"(",
"n",
"Node",
")",
"{",
"if",
"hasWildcard",
"{",
"return",
"\n",
"}",
"\n",
"swi... | // HasFieldWildcard returns whether or not the select statement has at least 1 wildcard in the fields. | [
"HasFieldWildcard",
"returns",
"whether",
"or",
"not",
"the",
"select",
"statement",
"has",
"at",
"least",
"1",
"wildcard",
"in",
"the",
"fields",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L1817-L1828 |
133,006 | influxdata/influxql | ast.go | HasDimensionWildcard | func (s *SelectStatement) HasDimensionWildcard() bool {
for _, d := range s.Dimensions {
switch d.Expr.(type) {
case *Wildcard, *RegexLiteral:
return true
}
}
return false
} | go | func (s *SelectStatement) HasDimensionWildcard() bool {
for _, d := range s.Dimensions {
switch d.Expr.(type) {
case *Wildcard, *RegexLiteral:
return true
}
}
return false
} | [
"func",
"(",
"s",
"*",
"SelectStatement",
")",
"HasDimensionWildcard",
"(",
")",
"bool",
"{",
"for",
"_",
",",
"d",
":=",
"range",
"s",
".",
"Dimensions",
"{",
"switch",
"d",
".",
"Expr",
".",
"(",
"type",
")",
"{",
"case",
"*",
"Wildcard",
",",
"*... | // HasDimensionWildcard returns whether or not the select statement has
// at least 1 wildcard in the dimensions aka `GROUP BY`. | [
"HasDimensionWildcard",
"returns",
"whether",
"or",
"not",
"the",
"select",
"statement",
"has",
"at",
"least",
"1",
"wildcard",
"in",
"the",
"dimensions",
"aka",
"GROUP",
"BY",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L1832-L1841 |
133,007 | influxdata/influxql | ast.go | GroupByInterval | func (s *SelectStatement) GroupByInterval() (time.Duration, error) {
// return if we've already pulled it out
if s.groupByInterval != 0 {
return s.groupByInterval, nil
}
// Ignore if there are no dimensions.
if len(s.Dimensions) == 0 {
return 0, nil
}
for _, d := range s.Dimensions {
if call, ok := d.Exp... | go | func (s *SelectStatement) GroupByInterval() (time.Duration, error) {
// return if we've already pulled it out
if s.groupByInterval != 0 {
return s.groupByInterval, nil
}
// Ignore if there are no dimensions.
if len(s.Dimensions) == 0 {
return 0, nil
}
for _, d := range s.Dimensions {
if call, ok := d.Exp... | [
"func",
"(",
"s",
"*",
"SelectStatement",
")",
"GroupByInterval",
"(",
")",
"(",
"time",
".",
"Duration",
",",
"error",
")",
"{",
"// return if we've already pulled it out",
"if",
"s",
".",
"groupByInterval",
"!=",
"0",
"{",
"return",
"s",
".",
"groupByInterva... | // GroupByInterval extracts the time interval, if specified. | [
"GroupByInterval",
"extracts",
"the",
"time",
"interval",
"if",
"specified",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L1844-L1872 |
133,008 | influxdata/influxql | ast.go | GroupByOffset | func (s *SelectStatement) GroupByOffset() (time.Duration, error) {
interval, err := s.GroupByInterval()
if err != nil {
return 0, err
}
// Ignore if there are no dimensions.
if len(s.Dimensions) == 0 {
return 0, nil
}
for _, d := range s.Dimensions {
if call, ok := d.Expr.(*Call); ok && call.Name == "tim... | go | func (s *SelectStatement) GroupByOffset() (time.Duration, error) {
interval, err := s.GroupByInterval()
if err != nil {
return 0, err
}
// Ignore if there are no dimensions.
if len(s.Dimensions) == 0 {
return 0, nil
}
for _, d := range s.Dimensions {
if call, ok := d.Expr.(*Call); ok && call.Name == "tim... | [
"func",
"(",
"s",
"*",
"SelectStatement",
")",
"GroupByOffset",
"(",
")",
"(",
"time",
".",
"Duration",
",",
"error",
")",
"{",
"interval",
",",
"err",
":=",
"s",
".",
"GroupByInterval",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
... | // GroupByOffset extracts the time interval offset, if specified. | [
"GroupByOffset",
"extracts",
"the",
"time",
"interval",
"offset",
"if",
"specified",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L1875-L1902 |
133,009 | influxdata/influxql | ast.go | SetTimeRange | func (s *SelectStatement) SetTimeRange(start, end time.Time) error {
cond := fmt.Sprintf("time >= '%s' AND time < '%s'", start.UTC().Format(time.RFC3339Nano), end.UTC().Format(time.RFC3339Nano))
if s.Condition != nil {
cond = fmt.Sprintf("%s AND %s", s.rewriteWithoutTimeDimensions(), cond)
}
expr, err := NewPars... | go | func (s *SelectStatement) SetTimeRange(start, end time.Time) error {
cond := fmt.Sprintf("time >= '%s' AND time < '%s'", start.UTC().Format(time.RFC3339Nano), end.UTC().Format(time.RFC3339Nano))
if s.Condition != nil {
cond = fmt.Sprintf("%s AND %s", s.rewriteWithoutTimeDimensions(), cond)
}
expr, err := NewPars... | [
"func",
"(",
"s",
"*",
"SelectStatement",
")",
"SetTimeRange",
"(",
"start",
",",
"end",
"time",
".",
"Time",
")",
"error",
"{",
"cond",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"start",
".",
"UTC",
"(",
")",
".",
"Format",
"(",
"time",
... | // SetTimeRange sets the start and end time of the select statement to [start, end). i.e. start inclusive, end exclusive.
// This is used commonly for continuous queries so the start and end are in buckets. | [
"SetTimeRange",
"sets",
"the",
"start",
"and",
"end",
"time",
"of",
"the",
"select",
"statement",
"to",
"[",
"start",
"end",
")",
".",
"i",
".",
"e",
".",
"start",
"inclusive",
"end",
"exclusive",
".",
"This",
"is",
"used",
"commonly",
"for",
"continuous... | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L1906-L1921 |
133,010 | influxdata/influxql | ast.go | rewriteWithoutTimeDimensions | func (s *SelectStatement) rewriteWithoutTimeDimensions() string {
n := RewriteFunc(s.Condition, func(n Node) Node {
switch n := n.(type) {
case *BinaryExpr:
if n.LHS.String() == "time" {
return &BooleanLiteral{Val: true}
}
return n
case *Call:
return &BooleanLiteral{Val: true}
default:
retur... | go | func (s *SelectStatement) rewriteWithoutTimeDimensions() string {
n := RewriteFunc(s.Condition, func(n Node) Node {
switch n := n.(type) {
case *BinaryExpr:
if n.LHS.String() == "time" {
return &BooleanLiteral{Val: true}
}
return n
case *Call:
return &BooleanLiteral{Val: true}
default:
retur... | [
"func",
"(",
"s",
"*",
"SelectStatement",
")",
"rewriteWithoutTimeDimensions",
"(",
")",
"string",
"{",
"n",
":=",
"RewriteFunc",
"(",
"s",
".",
"Condition",
",",
"func",
"(",
"n",
"Node",
")",
"Node",
"{",
"switch",
"n",
":=",
"n",
".",
"(",
"type",
... | // rewriteWithoutTimeDimensions will remove any WHERE time... clauses from the select statement.
// This is necessary when setting an explicit time range to override any that previously existed. | [
"rewriteWithoutTimeDimensions",
"will",
"remove",
"any",
"WHERE",
"time",
"...",
"clauses",
"from",
"the",
"select",
"statement",
".",
"This",
"is",
"necessary",
"when",
"setting",
"an",
"explicit",
"time",
"range",
"to",
"override",
"any",
"that",
"previously",
... | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L1925-L1941 |
133,011 | influxdata/influxql | ast.go | walkNames | func walkNames(exp Expr) []string {
switch expr := exp.(type) {
case *VarRef:
return []string{expr.Val}
case *Call:
var a []string
for _, expr := range expr.Args {
if ref, ok := expr.(*VarRef); ok {
a = append(a, ref.Val)
}
}
return a
case *BinaryExpr:
var ret []string
ret = append(ret, walk... | go | func walkNames(exp Expr) []string {
switch expr := exp.(type) {
case *VarRef:
return []string{expr.Val}
case *Call:
var a []string
for _, expr := range expr.Args {
if ref, ok := expr.(*VarRef); ok {
a = append(a, ref.Val)
}
}
return a
case *BinaryExpr:
var ret []string
ret = append(ret, walk... | [
"func",
"walkNames",
"(",
"exp",
"Expr",
")",
"[",
"]",
"string",
"{",
"switch",
"expr",
":=",
"exp",
".",
"(",
"type",
")",
"{",
"case",
"*",
"VarRef",
":",
"return",
"[",
"]",
"string",
"{",
"expr",
".",
"Val",
"}",
"\n",
"case",
"*",
"Call",
... | // walkNames will walk the Expr and return the identifier names used. | [
"walkNames",
"will",
"walk",
"the",
"Expr",
"and",
"return",
"the",
"identifier",
"names",
"used",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L1976-L1998 |
133,012 | influxdata/influxql | ast.go | walkRefs | func walkRefs(exp Expr) []VarRef {
refs := make(map[VarRef]struct{})
var walk func(exp Expr)
walk = func(exp Expr) {
switch expr := exp.(type) {
case *VarRef:
refs[*expr] = struct{}{}
case *Call:
for _, expr := range expr.Args {
if ref, ok := expr.(*VarRef); ok {
refs[*ref] = struct{}{}
}
... | go | func walkRefs(exp Expr) []VarRef {
refs := make(map[VarRef]struct{})
var walk func(exp Expr)
walk = func(exp Expr) {
switch expr := exp.(type) {
case *VarRef:
refs[*expr] = struct{}{}
case *Call:
for _, expr := range expr.Args {
if ref, ok := expr.(*VarRef); ok {
refs[*ref] = struct{}{}
}
... | [
"func",
"walkRefs",
"(",
"exp",
"Expr",
")",
"[",
"]",
"VarRef",
"{",
"refs",
":=",
"make",
"(",
"map",
"[",
"VarRef",
"]",
"struct",
"{",
"}",
")",
"\n",
"var",
"walk",
"func",
"(",
"exp",
"Expr",
")",
"\n",
"walk",
"=",
"func",
"(",
"exp",
"E... | // walkRefs will walk the Expr and return the var refs used. | [
"walkRefs",
"will",
"walk",
"the",
"Expr",
"and",
"return",
"the",
"var",
"refs",
"used",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L2001-L2029 |
133,013 | influxdata/influxql | ast.go | ExprNames | func ExprNames(expr Expr) []VarRef {
m := make(map[VarRef]struct{})
for _, ref := range walkRefs(expr) {
if ref.Val == "time" {
continue
}
m[ref] = struct{}{}
}
a := make([]VarRef, 0, len(m))
for k := range m {
a = append(a, k)
}
sort.Sort(VarRefs(a))
return a
} | go | func ExprNames(expr Expr) []VarRef {
m := make(map[VarRef]struct{})
for _, ref := range walkRefs(expr) {
if ref.Val == "time" {
continue
}
m[ref] = struct{}{}
}
a := make([]VarRef, 0, len(m))
for k := range m {
a = append(a, k)
}
sort.Sort(VarRefs(a))
return a
} | [
"func",
"ExprNames",
"(",
"expr",
"Expr",
")",
"[",
"]",
"VarRef",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"VarRef",
"]",
"struct",
"{",
"}",
")",
"\n",
"for",
"_",
",",
"ref",
":=",
"range",
"walkRefs",
"(",
"expr",
")",
"{",
"if",
"ref",
"."... | // ExprNames returns a list of non-"time" field names from an expression. | [
"ExprNames",
"returns",
"a",
"list",
"of",
"non",
"-",
"time",
"field",
"names",
"from",
"an",
"expression",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L2032-L2048 |
133,014 | influxdata/influxql | ast.go | String | func (t *Target) String() string {
if t == nil {
return ""
}
var buf bytes.Buffer
_, _ = buf.WriteString("INTO ")
_, _ = buf.WriteString(t.Measurement.String())
if t.Measurement.Name == "" {
_, _ = buf.WriteString(":MEASUREMENT")
}
return buf.String()
} | go | func (t *Target) String() string {
if t == nil {
return ""
}
var buf bytes.Buffer
_, _ = buf.WriteString("INTO ")
_, _ = buf.WriteString(t.Measurement.String())
if t.Measurement.Name == "" {
_, _ = buf.WriteString(":MEASUREMENT")
}
return buf.String()
} | [
"func",
"(",
"t",
"*",
"Target",
")",
"String",
"(",
")",
"string",
"{",
"if",
"t",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"_",
",",
"_",
"=",
"buf",
".",
"WriteString",
"(",
"\"",... | // String returns a string representation of the Target. | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"Target",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L2057-L2070 |
133,015 | influxdata/influxql | ast.go | String | func (e *ExplainStatement) String() string {
var buf bytes.Buffer
buf.WriteString("EXPLAIN ")
if e.Analyze {
buf.WriteString("ANALYZE ")
}
buf.WriteString(e.Statement.String())
return buf.String()
} | go | func (e *ExplainStatement) String() string {
var buf bytes.Buffer
buf.WriteString("EXPLAIN ")
if e.Analyze {
buf.WriteString("ANALYZE ")
}
buf.WriteString(e.Statement.String())
return buf.String()
} | [
"func",
"(",
"e",
"*",
"ExplainStatement",
")",
"String",
"(",
")",
"string",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"buf",
".",
"WriteString",
"(",
"\"",
"\"",
")",
"\n",
"if",
"e",
".",
"Analyze",
"{",
"buf",
".",
"WriteString",
"(",
"\... | // String returns a string representation of the explain statement. | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"explain",
"statement",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L2080-L2088 |
133,016 | influxdata/influxql | ast.go | String | func (s *DeleteStatement) String() string {
var buf bytes.Buffer
_, _ = buf.WriteString("DELETE FROM ")
_, _ = buf.WriteString(s.Source.String())
if s.Condition != nil {
_, _ = buf.WriteString(" WHERE ")
_, _ = buf.WriteString(s.Condition.String())
}
return buf.String()
} | go | func (s *DeleteStatement) String() string {
var buf bytes.Buffer
_, _ = buf.WriteString("DELETE FROM ")
_, _ = buf.WriteString(s.Source.String())
if s.Condition != nil {
_, _ = buf.WriteString(" WHERE ")
_, _ = buf.WriteString(s.Condition.String())
}
return buf.String()
} | [
"func",
"(",
"s",
"*",
"DeleteStatement",
")",
"String",
"(",
")",
"string",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"_",
",",
"_",
"=",
"buf",
".",
"WriteString",
"(",
"\"",
"\"",
")",
"\n",
"_",
",",
"_",
"=",
"buf",
".",
"WriteString"... | // String returns a string representation of the delete statement. | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"delete",
"statement",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L2105-L2114 |
133,017 | influxdata/influxql | ast.go | RequiredPrivileges | func (s *DeleteStatement) RequiredPrivileges() (ExecutionPrivileges, error) {
return ExecutionPrivileges{{Admin: false, Name: "", Privilege: WritePrivilege}}, nil
} | go | func (s *DeleteStatement) RequiredPrivileges() (ExecutionPrivileges, error) {
return ExecutionPrivileges{{Admin: false, Name: "", Privilege: WritePrivilege}}, nil
} | [
"func",
"(",
"s",
"*",
"DeleteStatement",
")",
"RequiredPrivileges",
"(",
")",
"(",
"ExecutionPrivileges",
",",
"error",
")",
"{",
"return",
"ExecutionPrivileges",
"{",
"{",
"Admin",
":",
"false",
",",
"Name",
":",
"\"",
"\"",
",",
"Privilege",
":",
"Write... | // RequiredPrivileges returns the privilege required to execute a DeleteStatement. | [
"RequiredPrivileges",
"returns",
"the",
"privilege",
"required",
"to",
"execute",
"a",
"DeleteStatement",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L2117-L2119 |
133,018 | influxdata/influxql | ast.go | DefaultDatabase | func (s *DeleteStatement) DefaultDatabase() string {
if m, ok := s.Source.(*Measurement); ok {
return m.Database
}
return ""
} | go | func (s *DeleteStatement) DefaultDatabase() string {
if m, ok := s.Source.(*Measurement); ok {
return m.Database
}
return ""
} | [
"func",
"(",
"s",
"*",
"DeleteStatement",
")",
"DefaultDatabase",
"(",
")",
"string",
"{",
"if",
"m",
",",
"ok",
":=",
"s",
".",
"Source",
".",
"(",
"*",
"Measurement",
")",
";",
"ok",
"{",
"return",
"m",
".",
"Database",
"\n",
"}",
"\n",
"return",... | // DefaultDatabase returns the default database from the statement. | [
"DefaultDatabase",
"returns",
"the",
"default",
"database",
"from",
"the",
"statement",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L2122-L2127 |
133,019 | influxdata/influxql | ast.go | RequiredPrivileges | func (s *DropShardStatement) RequiredPrivileges() (ExecutionPrivileges, error) {
return ExecutionPrivileges{{Admin: true, Name: "", Privilege: AllPrivileges}}, nil
} | go | func (s *DropShardStatement) RequiredPrivileges() (ExecutionPrivileges, error) {
return ExecutionPrivileges{{Admin: true, Name: "", Privilege: AllPrivileges}}, nil
} | [
"func",
"(",
"s",
"*",
"DropShardStatement",
")",
"RequiredPrivileges",
"(",
")",
"(",
"ExecutionPrivileges",
",",
"error",
")",
"{",
"return",
"ExecutionPrivileges",
"{",
"{",
"Admin",
":",
"true",
",",
"Name",
":",
"\"",
"\"",
",",
"Privilege",
":",
"All... | // RequiredPrivileges returns the privilege required to execute a
// DropShardStatement. | [
"RequiredPrivileges",
"returns",
"the",
"privilege",
"required",
"to",
"execute",
"a",
"DropShardStatement",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L2274-L2276 |
133,020 | influxdata/influxql | ast.go | RequiredPrivileges | func (s *ShowContinuousQueriesStatement) RequiredPrivileges() (ExecutionPrivileges, error) {
return ExecutionPrivileges{{Admin: false, Name: "", Privilege: ReadPrivilege}}, nil
} | go | func (s *ShowContinuousQueriesStatement) RequiredPrivileges() (ExecutionPrivileges, error) {
return ExecutionPrivileges{{Admin: false, Name: "", Privilege: ReadPrivilege}}, nil
} | [
"func",
"(",
"s",
"*",
"ShowContinuousQueriesStatement",
")",
"RequiredPrivileges",
"(",
")",
"(",
"ExecutionPrivileges",
",",
"error",
")",
"{",
"return",
"ExecutionPrivileges",
"{",
"{",
"Admin",
":",
"false",
",",
"Name",
":",
"\"",
"\"",
",",
"Privilege",
... | // RequiredPrivileges returns the privilege required to execute a ShowContinuousQueriesStatement. | [
"RequiredPrivileges",
"returns",
"the",
"privilege",
"required",
"to",
"execute",
"a",
"ShowContinuousQueriesStatement",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L2356-L2358 |
133,021 | influxdata/influxql | ast.go | String | func (s *ShowGrantsForUserStatement) String() string {
var buf bytes.Buffer
_, _ = buf.WriteString("SHOW GRANTS FOR ")
_, _ = buf.WriteString(QuoteIdent(s.Name))
return buf.String()
} | go | func (s *ShowGrantsForUserStatement) String() string {
var buf bytes.Buffer
_, _ = buf.WriteString("SHOW GRANTS FOR ")
_, _ = buf.WriteString(QuoteIdent(s.Name))
return buf.String()
} | [
"func",
"(",
"s",
"*",
"ShowGrantsForUserStatement",
")",
"String",
"(",
")",
"string",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"_",
",",
"_",
"=",
"buf",
".",
"WriteString",
"(",
"\"",
"\"",
")",
"\n",
"_",
",",
"_",
"=",
"buf",
".",
"W... | // String returns a string representation of the show grants for user. | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"show",
"grants",
"for",
"user",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L2367-L2373 |
133,022 | influxdata/influxql | ast.go | RequiredPrivileges | func (s *ShowDatabasesStatement) RequiredPrivileges() (ExecutionPrivileges, error) {
// SHOW DATABASES is one of few statements that have no required privileges.
// Anyone is allowed to execute it, but the returned results depend on the user's
// individual database permissions.
return ExecutionPrivileges{{Admin: f... | go | func (s *ShowDatabasesStatement) RequiredPrivileges() (ExecutionPrivileges, error) {
// SHOW DATABASES is one of few statements that have no required privileges.
// Anyone is allowed to execute it, but the returned results depend on the user's
// individual database permissions.
return ExecutionPrivileges{{Admin: f... | [
"func",
"(",
"s",
"*",
"ShowDatabasesStatement",
")",
"RequiredPrivileges",
"(",
")",
"(",
"ExecutionPrivileges",
",",
"error",
")",
"{",
"// SHOW DATABASES is one of few statements that have no required privileges.",
"// Anyone is allowed to execute it, but the returned results depe... | // RequiredPrivileges returns the privilege required to execute a ShowDatabasesStatement. | [
"RequiredPrivileges",
"returns",
"the",
"privilege",
"required",
"to",
"execute",
"a",
"ShowDatabasesStatement",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L2387-L2392 |
133,023 | influxdata/influxql | ast.go | RequiredPrivileges | func (s *CreateContinuousQueryStatement) RequiredPrivileges() (ExecutionPrivileges, error) {
ep := ExecutionPrivileges{{Admin: false, Name: s.Database, Privilege: ReadPrivilege}}
// Selecting into a database that's different from the source?
if s.Source.Target.Measurement.Database != "" {
// Change source databas... | go | func (s *CreateContinuousQueryStatement) RequiredPrivileges() (ExecutionPrivileges, error) {
ep := ExecutionPrivileges{{Admin: false, Name: s.Database, Privilege: ReadPrivilege}}
// Selecting into a database that's different from the source?
if s.Source.Target.Measurement.Database != "" {
// Change source databas... | [
"func",
"(",
"s",
"*",
"CreateContinuousQueryStatement",
")",
"RequiredPrivileges",
"(",
")",
"(",
"ExecutionPrivileges",
",",
"error",
")",
"{",
"ep",
":=",
"ExecutionPrivileges",
"{",
"{",
"Admin",
":",
"false",
",",
"Name",
":",
"s",
".",
"Database",
",",... | // RequiredPrivileges returns the privilege required to execute a CreateContinuousQueryStatement. | [
"RequiredPrivileges",
"returns",
"the",
"privilege",
"required",
"to",
"execute",
"a",
"CreateContinuousQueryStatement",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L2436-L2454 |
133,024 | influxdata/influxql | ast.go | RequiredPrivileges | func (s *ShowMeasurementCardinalityStatement) RequiredPrivileges() (ExecutionPrivileges, error) {
if !s.Exact {
return ExecutionPrivileges{{Admin: false, Name: s.Database, Privilege: ReadPrivilege}}, nil
}
return s.Sources.RequiredPrivileges()
} | go | func (s *ShowMeasurementCardinalityStatement) RequiredPrivileges() (ExecutionPrivileges, error) {
if !s.Exact {
return ExecutionPrivileges{{Admin: false, Name: s.Database, Privilege: ReadPrivilege}}, nil
}
return s.Sources.RequiredPrivileges()
} | [
"func",
"(",
"s",
"*",
"ShowMeasurementCardinalityStatement",
")",
"RequiredPrivileges",
"(",
")",
"(",
"ExecutionPrivileges",
",",
"error",
")",
"{",
"if",
"!",
"s",
".",
"Exact",
"{",
"return",
"ExecutionPrivileges",
"{",
"{",
"Admin",
":",
"false",
",",
"... | // RequiredPrivileges returns the privilege required to execute a ShowMeasurementCardinalityStatement. | [
"RequiredPrivileges",
"returns",
"the",
"privilege",
"required",
"to",
"execute",
"a",
"ShowMeasurementCardinalityStatement",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L2542-L2547 |
133,025 | influxdata/influxql | ast.go | String | func (s *ShowRetentionPoliciesStatement) String() string {
var buf bytes.Buffer
_, _ = buf.WriteString("SHOW RETENTION POLICIES")
if s.Database != "" {
_, _ = buf.WriteString(" ON ")
_, _ = buf.WriteString(QuoteIdent(s.Database))
}
return buf.String()
} | go | func (s *ShowRetentionPoliciesStatement) String() string {
var buf bytes.Buffer
_, _ = buf.WriteString("SHOW RETENTION POLICIES")
if s.Database != "" {
_, _ = buf.WriteString(" ON ")
_, _ = buf.WriteString(QuoteIdent(s.Database))
}
return buf.String()
} | [
"func",
"(",
"s",
"*",
"ShowRetentionPoliciesStatement",
")",
"String",
"(",
")",
"string",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"_",
",",
"_",
"=",
"buf",
".",
"WriteString",
"(",
"\"",
"\"",
")",
"\n",
"if",
"s",
".",
"Database",
"!=",
... | // String returns a string representation of a ShowRetentionPoliciesStatement. | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"a",
"ShowRetentionPoliciesStatement",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L2662-L2670 |
133,026 | influxdata/influxql | ast.go | String | func (s *ShowDiagnosticsStatement) String() string {
var buf bytes.Buffer
_, _ = buf.WriteString("SHOW DIAGNOSTICS")
if s.Module != "" {
_, _ = buf.WriteString(" FOR ")
_, _ = buf.WriteString(QuoteString(s.Module))
}
return buf.String()
} | go | func (s *ShowDiagnosticsStatement) String() string {
var buf bytes.Buffer
_, _ = buf.WriteString("SHOW DIAGNOSTICS")
if s.Module != "" {
_, _ = buf.WriteString(" FOR ")
_, _ = buf.WriteString(QuoteString(s.Module))
}
return buf.String()
} | [
"func",
"(",
"s",
"*",
"ShowDiagnosticsStatement",
")",
"String",
"(",
")",
"string",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"_",
",",
"_",
"=",
"buf",
".",
"WriteString",
"(",
"\"",
"\"",
")",
"\n",
"if",
"s",
".",
"Module",
"!=",
"\"",
... | // String returns a string representation of the ShowDiagnosticsStatement. | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"ShowDiagnosticsStatement",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L2732-L2740 |
133,027 | influxdata/influxql | ast.go | String | func (s *CreateSubscriptionStatement) String() string {
var buf bytes.Buffer
_, _ = buf.WriteString("CREATE SUBSCRIPTION ")
_, _ = buf.WriteString(QuoteIdent(s.Name))
_, _ = buf.WriteString(" ON ")
_, _ = buf.WriteString(QuoteIdent(s.Database))
_, _ = buf.WriteString(".")
_, _ = buf.WriteString(QuoteIdent(s.Rete... | go | func (s *CreateSubscriptionStatement) String() string {
var buf bytes.Buffer
_, _ = buf.WriteString("CREATE SUBSCRIPTION ")
_, _ = buf.WriteString(QuoteIdent(s.Name))
_, _ = buf.WriteString(" ON ")
_, _ = buf.WriteString(QuoteIdent(s.Database))
_, _ = buf.WriteString(".")
_, _ = buf.WriteString(QuoteIdent(s.Rete... | [
"func",
"(",
"s",
"*",
"CreateSubscriptionStatement",
")",
"String",
"(",
")",
"string",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"_",
",",
"_",
"=",
"buf",
".",
"WriteString",
"(",
"\"",
"\"",
")",
"\n",
"_",
",",
"_",
"=",
"buf",
".",
"... | // String returns a string representation of the CreateSubscriptionStatement. | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"CreateSubscriptionStatement",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L2757-L2776 |
133,028 | influxdata/influxql | ast.go | String | func (s *DropSubscriptionStatement) String() string {
return fmt.Sprintf(`DROP SUBSCRIPTION %s ON %s.%s`, QuoteIdent(s.Name), QuoteIdent(s.Database), QuoteIdent(s.RetentionPolicy))
} | go | func (s *DropSubscriptionStatement) String() string {
return fmt.Sprintf(`DROP SUBSCRIPTION %s ON %s.%s`, QuoteIdent(s.Name), QuoteIdent(s.Database), QuoteIdent(s.RetentionPolicy))
} | [
"func",
"(",
"s",
"*",
"DropSubscriptionStatement",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"`DROP SUBSCRIPTION %s ON %s.%s`",
",",
"QuoteIdent",
"(",
"s",
".",
"Name",
")",
",",
"QuoteIdent",
"(",
"s",
".",
"Database",
... | // String returns a string representation of the DropSubscriptionStatement. | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"DropSubscriptionStatement",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L2796-L2798 |
133,029 | influxdata/influxql | ast.go | AliasNames | func (a Fields) AliasNames() []string {
names := []string{}
for _, f := range a {
names = append(names, f.Name())
}
return names
} | go | func (a Fields) AliasNames() []string {
names := []string{}
for _, f := range a {
names = append(names, f.Name())
}
return names
} | [
"func",
"(",
"a",
"Fields",
")",
"AliasNames",
"(",
")",
"[",
"]",
"string",
"{",
"names",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"a",
"{",
"names",
"=",
"append",
"(",
"names",
",",
"f",
".",
"Name",
"... | // AliasNames returns a list of calculated field names in
// order of alias, function name, then field. | [
"AliasNames",
"returns",
"a",
"list",
"of",
"calculated",
"field",
"names",
"in",
"order",
"of",
"alias",
"function",
"name",
"then",
"field",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3233-L3239 |
133,030 | influxdata/influxql | ast.go | Names | func (a Fields) Names() []string {
names := []string{}
for _, f := range a {
switch expr := f.Expr.(type) {
case *Call:
names = append(names, expr.Name)
case *VarRef:
names = append(names, expr.Val)
case *BinaryExpr:
names = append(names, walkNames(expr)...)
case *ParenExpr:
names = append(names... | go | func (a Fields) Names() []string {
names := []string{}
for _, f := range a {
switch expr := f.Expr.(type) {
case *Call:
names = append(names, expr.Name)
case *VarRef:
names = append(names, expr.Val)
case *BinaryExpr:
names = append(names, walkNames(expr)...)
case *ParenExpr:
names = append(names... | [
"func",
"(",
"a",
"Fields",
")",
"Names",
"(",
")",
"[",
"]",
"string",
"{",
"names",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"a",
"{",
"switch",
"expr",
":=",
"f",
".",
"Expr",
".",
"(",
"type",
")",
... | // Names returns a list of field names. | [
"Names",
"returns",
"a",
"list",
"of",
"field",
"names",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3242-L3257 |
133,031 | influxdata/influxql | ast.go | String | func (a Fields) String() string {
var str []string
for _, f := range a {
str = append(str, f.String())
}
return strings.Join(str, ", ")
} | go | func (a Fields) String() string {
var str []string
for _, f := range a {
str = append(str, f.String())
}
return strings.Join(str, ", ")
} | [
"func",
"(",
"a",
"Fields",
")",
"String",
"(",
")",
"string",
"{",
"var",
"str",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"a",
"{",
"str",
"=",
"append",
"(",
"str",
",",
"f",
".",
"String",
"(",
")",
")",
"\n",
"}",
... | // String returns a string representation of the fields. | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"fields",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3260-L3266 |
133,032 | influxdata/influxql | ast.go | Name | func (f *Field) Name() string {
// Return alias, if set.
if f.Alias != "" {
return f.Alias
}
// Return the function name or variable name, if available.
switch expr := f.Expr.(type) {
case *Call:
return expr.Name
case *BinaryExpr:
return BinaryExprName(expr)
case *ParenExpr:
f := Field{Expr: expr.Expr}... | go | func (f *Field) Name() string {
// Return alias, if set.
if f.Alias != "" {
return f.Alias
}
// Return the function name or variable name, if available.
switch expr := f.Expr.(type) {
case *Call:
return expr.Name
case *BinaryExpr:
return BinaryExprName(expr)
case *ParenExpr:
f := Field{Expr: expr.Expr}... | [
"func",
"(",
"f",
"*",
"Field",
")",
"Name",
"(",
")",
"string",
"{",
"// Return alias, if set.",
"if",
"f",
".",
"Alias",
"!=",
"\"",
"\"",
"{",
"return",
"f",
".",
"Alias",
"\n",
"}",
"\n\n",
"// Return the function name or variable name, if available.",
"sw... | // Name returns the name of the field. Returns alias, if set.
// Otherwise uses the function name or variable name. | [
"Name",
"returns",
"the",
"name",
"of",
"the",
"field",
".",
"Returns",
"alias",
"if",
"set",
".",
"Otherwise",
"uses",
"the",
"function",
"name",
"or",
"variable",
"name",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3276-L3297 |
133,033 | influxdata/influxql | ast.go | String | func (f *Field) String() string {
str := f.Expr.String()
if f.Alias == "" {
return str
}
return fmt.Sprintf("%s AS %s", str, QuoteIdent(f.Alias))
} | go | func (f *Field) String() string {
str := f.Expr.String()
if f.Alias == "" {
return str
}
return fmt.Sprintf("%s AS %s", str, QuoteIdent(f.Alias))
} | [
"func",
"(",
"f",
"*",
"Field",
")",
"String",
"(",
")",
"string",
"{",
"str",
":=",
"f",
".",
"Expr",
".",
"String",
"(",
")",
"\n\n",
"if",
"f",
".",
"Alias",
"==",
"\"",
"\"",
"{",
"return",
"str",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"S... | // String returns a string representation of the field. | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"field",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3300-L3307 |
133,034 | influxdata/influxql | ast.go | String | func (a Dimensions) String() string {
var str []string
for _, d := range a {
str = append(str, d.String())
}
return strings.Join(str, ", ")
} | go | func (a Dimensions) String() string {
var str []string
for _, d := range a {
str = append(str, d.String())
}
return strings.Join(str, ", ")
} | [
"func",
"(",
"a",
"Dimensions",
")",
"String",
"(",
")",
"string",
"{",
"var",
"str",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"d",
":=",
"range",
"a",
"{",
"str",
"=",
"append",
"(",
"str",
",",
"d",
".",
"String",
"(",
")",
")",
"\n",
"}"... | // String returns a string representation of the dimensions. | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"dimensions",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3322-L3328 |
133,035 | influxdata/influxql | ast.go | Normalize | func (a Dimensions) Normalize() (time.Duration, []string) {
var dur time.Duration
var tags []string
for _, dim := range a {
switch expr := dim.Expr.(type) {
case *Call:
lit, _ := expr.Args[0].(*DurationLiteral)
dur = lit.Val
case *VarRef:
tags = append(tags, expr.Val)
}
}
return dur, tags
} | go | func (a Dimensions) Normalize() (time.Duration, []string) {
var dur time.Duration
var tags []string
for _, dim := range a {
switch expr := dim.Expr.(type) {
case *Call:
lit, _ := expr.Args[0].(*DurationLiteral)
dur = lit.Val
case *VarRef:
tags = append(tags, expr.Val)
}
}
return dur, tags
} | [
"func",
"(",
"a",
"Dimensions",
")",
"Normalize",
"(",
")",
"(",
"time",
".",
"Duration",
",",
"[",
"]",
"string",
")",
"{",
"var",
"dur",
"time",
".",
"Duration",
"\n",
"var",
"tags",
"[",
"]",
"string",
"\n\n",
"for",
"_",
",",
"dim",
":=",
"ra... | // Normalize returns the interval and tag dimensions separately.
// Returns 0 if no time interval is specified. | [
"Normalize",
"returns",
"the",
"interval",
"and",
"tag",
"dimensions",
"separately",
".",
"Returns",
"0",
"if",
"no",
"time",
"interval",
"is",
"specified",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3332-L3347 |
133,036 | influxdata/influxql | ast.go | String | func (a Measurements) String() string {
var str []string
for _, m := range a {
str = append(str, m.String())
}
return strings.Join(str, ", ")
} | go | func (a Measurements) String() string {
var str []string
for _, m := range a {
str = append(str, m.String())
}
return strings.Join(str, ", ")
} | [
"func",
"(",
"a",
"Measurements",
")",
"String",
"(",
")",
"string",
"{",
"var",
"str",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"m",
":=",
"range",
"a",
"{",
"str",
"=",
"append",
"(",
"str",
",",
"m",
".",
"String",
"(",
")",
")",
"\n",
"... | // String returns a string representation of the measurements. | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"measurements",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3361-L3367 |
133,037 | influxdata/influxql | ast.go | Clone | func (m *Measurement) Clone() *Measurement {
var regexp *RegexLiteral
if m.Regex != nil && m.Regex.Val != nil {
regexp = &RegexLiteral{Val: m.Regex.Val.Copy()}
}
return &Measurement{
Database: m.Database,
RetentionPolicy: m.RetentionPolicy,
Name: m.Name,
Regex: regexp,
IsTarg... | go | func (m *Measurement) Clone() *Measurement {
var regexp *RegexLiteral
if m.Regex != nil && m.Regex.Val != nil {
regexp = &RegexLiteral{Val: m.Regex.Val.Copy()}
}
return &Measurement{
Database: m.Database,
RetentionPolicy: m.RetentionPolicy,
Name: m.Name,
Regex: regexp,
IsTarg... | [
"func",
"(",
"m",
"*",
"Measurement",
")",
"Clone",
"(",
")",
"*",
"Measurement",
"{",
"var",
"regexp",
"*",
"RegexLiteral",
"\n",
"if",
"m",
".",
"Regex",
"!=",
"nil",
"&&",
"m",
".",
"Regex",
".",
"Val",
"!=",
"nil",
"{",
"regexp",
"=",
"&",
"R... | // Clone returns a deep clone of the Measurement. | [
"Clone",
"returns",
"a",
"deep",
"clone",
"of",
"the",
"Measurement",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3383-L3396 |
133,038 | influxdata/influxql | ast.go | String | func (m *Measurement) String() string {
var buf bytes.Buffer
if m.Database != "" {
_, _ = buf.WriteString(QuoteIdent(m.Database))
_, _ = buf.WriteString(".")
}
if m.RetentionPolicy != "" {
_, _ = buf.WriteString(QuoteIdent(m.RetentionPolicy))
}
if m.Database != "" || m.RetentionPolicy != "" {
_, _ = buf... | go | func (m *Measurement) String() string {
var buf bytes.Buffer
if m.Database != "" {
_, _ = buf.WriteString(QuoteIdent(m.Database))
_, _ = buf.WriteString(".")
}
if m.RetentionPolicy != "" {
_, _ = buf.WriteString(QuoteIdent(m.RetentionPolicy))
}
if m.Database != "" || m.RetentionPolicy != "" {
_, _ = buf... | [
"func",
"(",
"m",
"*",
"Measurement",
")",
"String",
"(",
")",
"string",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"if",
"m",
".",
"Database",
"!=",
"\"",
"\"",
"{",
"_",
",",
"_",
"=",
"buf",
".",
"WriteString",
"(",
"QuoteIdent",
"(",
"m... | // String returns a string representation of the measurement. | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"measurement",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3399-L3423 |
133,039 | influxdata/influxql | ast.go | String | func (r *VarRef) String() string {
buf := bytes.NewBufferString(QuoteIdent(r.Val))
if r.Type != Unknown {
buf.WriteString("::")
buf.WriteString(r.Type.String())
}
return buf.String()
} | go | func (r *VarRef) String() string {
buf := bytes.NewBufferString(QuoteIdent(r.Val))
if r.Type != Unknown {
buf.WriteString("::")
buf.WriteString(r.Type.String())
}
return buf.String()
} | [
"func",
"(",
"r",
"*",
"VarRef",
")",
"String",
"(",
")",
"string",
"{",
"buf",
":=",
"bytes",
".",
"NewBufferString",
"(",
"QuoteIdent",
"(",
"r",
".",
"Val",
")",
")",
"\n",
"if",
"r",
".",
"Type",
"!=",
"Unknown",
"{",
"buf",
".",
"WriteString",... | // String returns a string representation of the variable reference. | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"variable",
"reference",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3442-L3449 |
133,040 | influxdata/influxql | ast.go | Strings | func (a VarRefs) Strings() []string {
s := make([]string, len(a))
for i, ref := range a {
s[i] = ref.Val
}
return s
} | go | func (a VarRefs) Strings() []string {
s := make([]string, len(a))
for i, ref := range a {
s[i] = ref.Val
}
return s
} | [
"func",
"(",
"a",
"VarRefs",
")",
"Strings",
"(",
")",
"[",
"]",
"string",
"{",
"s",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"a",
")",
")",
"\n",
"for",
"i",
",",
"ref",
":=",
"range",
"a",
"{",
"s",
"[",
"i",
"]",
"=",
"r... | // Strings returns a slice of the variable names. | [
"Strings",
"returns",
"a",
"slice",
"of",
"the",
"variable",
"names",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3469-L3475 |
133,041 | influxdata/influxql | ast.go | String | func (c *Call) String() string {
// Join arguments.
var str []string
for _, arg := range c.Args {
str = append(str, arg.String())
}
// Write function name and args.
return fmt.Sprintf("%s(%s)", c.Name, strings.Join(str, ", "))
} | go | func (c *Call) String() string {
// Join arguments.
var str []string
for _, arg := range c.Args {
str = append(str, arg.String())
}
// Write function name and args.
return fmt.Sprintf("%s(%s)", c.Name, strings.Join(str, ", "))
} | [
"func",
"(",
"c",
"*",
"Call",
")",
"String",
"(",
")",
"string",
"{",
"// Join arguments.",
"var",
"str",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"arg",
":=",
"range",
"c",
".",
"Args",
"{",
"str",
"=",
"append",
"(",
"str",
",",
"arg",
".",
... | // String returns a string representation of the call. | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"call",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3484-L3493 |
133,042 | influxdata/influxql | ast.go | NewCall | func (d *Distinct) NewCall() *Call {
return &Call{
Name: "distinct",
Args: []Expr{
&VarRef{Val: d.Val},
},
}
} | go | func (d *Distinct) NewCall() *Call {
return &Call{
Name: "distinct",
Args: []Expr{
&VarRef{Val: d.Val},
},
}
} | [
"func",
"(",
"d",
"*",
"Distinct",
")",
"NewCall",
"(",
")",
"*",
"Call",
"{",
"return",
"&",
"Call",
"{",
"Name",
":",
"\"",
"\"",
",",
"Args",
":",
"[",
"]",
"Expr",
"{",
"&",
"VarRef",
"{",
"Val",
":",
"d",
".",
"Val",
"}",
",",
"}",
","... | // NewCall returns a new call expression from this expressions. | [
"NewCall",
"returns",
"a",
"new",
"call",
"expression",
"from",
"this",
"expressions",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3507-L3514 |
133,043 | influxdata/influxql | ast.go | isTrueLiteral | func isTrueLiteral(expr Expr) bool {
if expr, ok := expr.(*BooleanLiteral); ok {
return expr.Val == true
}
return false
} | go | func isTrueLiteral(expr Expr) bool {
if expr, ok := expr.(*BooleanLiteral); ok {
return expr.Val == true
}
return false
} | [
"func",
"isTrueLiteral",
"(",
"expr",
"Expr",
")",
"bool",
"{",
"if",
"expr",
",",
"ok",
":=",
"expr",
".",
"(",
"*",
"BooleanLiteral",
")",
";",
"ok",
"{",
"return",
"expr",
".",
"Val",
"==",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] | // isTrueLiteral returns true if the expression is a literal "true" value. | [
"isTrueLiteral",
"returns",
"true",
"if",
"the",
"expression",
"is",
"a",
"literal",
"true",
"value",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3555-L3560 |
133,044 | influxdata/influxql | ast.go | isFalseLiteral | func isFalseLiteral(expr Expr) bool {
if expr, ok := expr.(*BooleanLiteral); ok {
return expr.Val == false
}
return false
} | go | func isFalseLiteral(expr Expr) bool {
if expr, ok := expr.(*BooleanLiteral); ok {
return expr.Val == false
}
return false
} | [
"func",
"isFalseLiteral",
"(",
"expr",
"Expr",
")",
"bool",
"{",
"if",
"expr",
",",
"ok",
":=",
"expr",
".",
"(",
"*",
"BooleanLiteral",
")",
";",
"ok",
"{",
"return",
"expr",
".",
"Val",
"==",
"false",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"... | // isFalseLiteral returns true if the expression is a literal "false" value. | [
"isFalseLiteral",
"returns",
"true",
"if",
"the",
"expression",
"is",
"a",
"literal",
"false",
"value",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3563-L3568 |
133,045 | influxdata/influxql | ast.go | IsTimeLiteral | func (l *StringLiteral) IsTimeLiteral() bool {
return isDateTimeString(l.Val) || isDateString(l.Val)
} | go | func (l *StringLiteral) IsTimeLiteral() bool {
return isDateTimeString(l.Val) || isDateString(l.Val)
} | [
"func",
"(",
"l",
"*",
"StringLiteral",
")",
"IsTimeLiteral",
"(",
")",
"bool",
"{",
"return",
"isDateTimeString",
"(",
"l",
".",
"Val",
")",
"||",
"isDateString",
"(",
"l",
".",
"Val",
")",
"\n",
"}"
] | // IsTimeLiteral returns if this string can be interpreted as a time literal. | [
"IsTimeLiteral",
"returns",
"if",
"this",
"string",
"can",
"be",
"interpreted",
"as",
"a",
"time",
"literal",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3598-L3600 |
133,046 | influxdata/influxql | ast.go | ToTimeLiteral | func (l *StringLiteral) ToTimeLiteral(loc *time.Location) (*TimeLiteral, error) {
if loc == nil {
loc = time.UTC
}
if isDateTimeString(l.Val) {
t, err := time.ParseInLocation(DateTimeFormat, l.Val, loc)
if err != nil {
// try to parse it as an RFCNano time
t, err = time.ParseInLocation(time.RFC3339Nano,... | go | func (l *StringLiteral) ToTimeLiteral(loc *time.Location) (*TimeLiteral, error) {
if loc == nil {
loc = time.UTC
}
if isDateTimeString(l.Val) {
t, err := time.ParseInLocation(DateTimeFormat, l.Val, loc)
if err != nil {
// try to parse it as an RFCNano time
t, err = time.ParseInLocation(time.RFC3339Nano,... | [
"func",
"(",
"l",
"*",
"StringLiteral",
")",
"ToTimeLiteral",
"(",
"loc",
"*",
"time",
".",
"Location",
")",
"(",
"*",
"TimeLiteral",
",",
"error",
")",
"{",
"if",
"loc",
"==",
"nil",
"{",
"loc",
"=",
"time",
".",
"UTC",
"\n",
"}",
"\n\n",
"if",
... | // ToTimeLiteral returns a time literal if this string can be converted to a time literal. | [
"ToTimeLiteral",
"returns",
"a",
"time",
"literal",
"if",
"this",
"string",
"can",
"be",
"converted",
"to",
"a",
"time",
"literal",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3603-L3626 |
133,047 | influxdata/influxql | ast.go | String | func (e *BinaryExpr) String() string {
return fmt.Sprintf("%s %s %s", e.LHS.String(), e.Op.String(), e.RHS.String())
} | go | func (e *BinaryExpr) String() string {
return fmt.Sprintf("%s %s %s", e.LHS.String(), e.Op.String(), e.RHS.String())
} | [
"func",
"(",
"e",
"*",
"BinaryExpr",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"e",
".",
"LHS",
".",
"String",
"(",
")",
",",
"e",
".",
"Op",
".",
"String",
"(",
")",
",",
"e",
".",
"RHS",
... | // String returns a string representation of the binary expression. | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"binary",
"expression",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3673-L3675 |
133,048 | influxdata/influxql | ast.go | BinaryExprName | func BinaryExprName(expr *BinaryExpr) string {
v := binaryExprNameVisitor{}
Walk(&v, expr)
return strings.Join(v.names, "_")
} | go | func BinaryExprName(expr *BinaryExpr) string {
v := binaryExprNameVisitor{}
Walk(&v, expr)
return strings.Join(v.names, "_")
} | [
"func",
"BinaryExprName",
"(",
"expr",
"*",
"BinaryExpr",
")",
"string",
"{",
"v",
":=",
"binaryExprNameVisitor",
"{",
"}",
"\n",
"Walk",
"(",
"&",
"v",
",",
"expr",
")",
"\n",
"return",
"strings",
".",
"Join",
"(",
"v",
".",
"names",
",",
"\"",
"\""... | // BinaryExprName returns the name of a binary expression by concatenating
// the variables in the binary expression with underscores. | [
"BinaryExprName",
"returns",
"the",
"name",
"of",
"a",
"binary",
"expression",
"by",
"concatenating",
"the",
"variables",
"in",
"the",
"binary",
"expression",
"with",
"underscores",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3679-L3683 |
133,049 | influxdata/influxql | ast.go | CloneRegexLiteral | func CloneRegexLiteral(r *RegexLiteral) *RegexLiteral {
if r == nil {
return nil
}
clone := &RegexLiteral{}
if r.Val != nil {
clone.Val = regexp.MustCompile(r.Val.String())
}
return clone
} | go | func CloneRegexLiteral(r *RegexLiteral) *RegexLiteral {
if r == nil {
return nil
}
clone := &RegexLiteral{}
if r.Val != nil {
clone.Val = regexp.MustCompile(r.Val.String())
}
return clone
} | [
"func",
"CloneRegexLiteral",
"(",
"r",
"*",
"RegexLiteral",
")",
"*",
"RegexLiteral",
"{",
"if",
"r",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"clone",
":=",
"&",
"RegexLiteral",
"{",
"}",
"\n",
"if",
"r",
".",
"Val",
"!=",
"nil",
"{",
... | // CloneRegexLiteral returns a clone of the RegexLiteral. | [
"CloneRegexLiteral",
"returns",
"a",
"clone",
"of",
"the",
"RegexLiteral",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3722-L3733 |
133,050 | influxdata/influxql | ast.go | CloneExpr | func CloneExpr(expr Expr) Expr {
if expr == nil {
return nil
}
switch expr := expr.(type) {
case *BinaryExpr:
return &BinaryExpr{Op: expr.Op, LHS: CloneExpr(expr.LHS), RHS: CloneExpr(expr.RHS)}
case *BooleanLiteral:
return &BooleanLiteral{Val: expr.Val}
case *Call:
args := make([]Expr, len(expr.Args))
f... | go | func CloneExpr(expr Expr) Expr {
if expr == nil {
return nil
}
switch expr := expr.(type) {
case *BinaryExpr:
return &BinaryExpr{Op: expr.Op, LHS: CloneExpr(expr.LHS), RHS: CloneExpr(expr.RHS)}
case *BooleanLiteral:
return &BooleanLiteral{Val: expr.Val}
case *Call:
args := make([]Expr, len(expr.Args))
f... | [
"func",
"CloneExpr",
"(",
"expr",
"Expr",
")",
"Expr",
"{",
"if",
"expr",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"switch",
"expr",
":=",
"expr",
".",
"(",
"type",
")",
"{",
"case",
"*",
"BinaryExpr",
":",
"return",
"&",
"BinaryExpr",
"... | // CloneExpr returns a deep copy of the expression. | [
"CloneExpr",
"returns",
"a",
"deep",
"copy",
"of",
"the",
"expression",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3753-L3792 |
133,051 | influxdata/influxql | ast.go | HasTimeExpr | func HasTimeExpr(expr Expr) bool {
switch n := expr.(type) {
case *BinaryExpr:
if n.Op == AND || n.Op == OR {
return HasTimeExpr(n.LHS) || HasTimeExpr(n.RHS)
}
if ref, ok := n.LHS.(*VarRef); ok && strings.ToLower(ref.Val) == "time" {
return true
}
return false
case *ParenExpr:
// walk down the tree... | go | func HasTimeExpr(expr Expr) bool {
switch n := expr.(type) {
case *BinaryExpr:
if n.Op == AND || n.Op == OR {
return HasTimeExpr(n.LHS) || HasTimeExpr(n.RHS)
}
if ref, ok := n.LHS.(*VarRef); ok && strings.ToLower(ref.Val) == "time" {
return true
}
return false
case *ParenExpr:
// walk down the tree... | [
"func",
"HasTimeExpr",
"(",
"expr",
"Expr",
")",
"bool",
"{",
"switch",
"n",
":=",
"expr",
".",
"(",
"type",
")",
"{",
"case",
"*",
"BinaryExpr",
":",
"if",
"n",
".",
"Op",
"==",
"AND",
"||",
"n",
".",
"Op",
"==",
"OR",
"{",
"return",
"HasTimeExp... | // HasTimeExpr returns true if the expression has a time term. | [
"HasTimeExpr",
"returns",
"true",
"if",
"the",
"expression",
"has",
"a",
"time",
"term",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3795-L3811 |
133,052 | influxdata/influxql | ast.go | Rewrite | func Rewrite(r Rewriter, node Node) Node {
switch n := node.(type) {
case *Query:
n.Statements = Rewrite(r, n.Statements).(Statements)
case Statements:
for i, s := range n {
n[i] = Rewrite(r, s).(Statement)
}
case *SelectStatement:
n.Fields = Rewrite(r, n.Fields).(Fields)
n.Dimensions = Rewrite(r, n.... | go | func Rewrite(r Rewriter, node Node) Node {
switch n := node.(type) {
case *Query:
n.Statements = Rewrite(r, n.Statements).(Statements)
case Statements:
for i, s := range n {
n[i] = Rewrite(r, s).(Statement)
}
case *SelectStatement:
n.Fields = Rewrite(r, n.Fields).(Fields)
n.Dimensions = Rewrite(r, n.... | [
"func",
"Rewrite",
"(",
"r",
"Rewriter",
",",
"node",
"Node",
")",
"Node",
"{",
"switch",
"n",
":=",
"node",
".",
"(",
"type",
")",
"{",
"case",
"*",
"Query",
":",
"n",
".",
"Statements",
"=",
"Rewrite",
"(",
"r",
",",
"n",
".",
"Statements",
")"... | // Rewrite recursively invokes the rewriter to replace each node.
// Nodes are traversed depth-first and rewritten from leaf to root. | [
"Rewrite",
"recursively",
"invokes",
"the",
"rewriter",
"to",
"replace",
"each",
"node",
".",
"Nodes",
"are",
"traversed",
"depth",
"-",
"first",
"and",
"rewritten",
"from",
"leaf",
"to",
"root",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L3963-L4020 |
133,053 | influxdata/influxql | ast.go | RewriteFunc | func RewriteFunc(node Node, fn func(Node) Node) Node {
return Rewrite(rewriterFunc(fn), node)
} | go | func RewriteFunc(node Node, fn func(Node) Node) Node {
return Rewrite(rewriterFunc(fn), node)
} | [
"func",
"RewriteFunc",
"(",
"node",
"Node",
",",
"fn",
"func",
"(",
"Node",
")",
"Node",
")",
"Node",
"{",
"return",
"Rewrite",
"(",
"rewriterFunc",
"(",
"fn",
")",
",",
"node",
")",
"\n",
"}"
] | // RewriteFunc rewrites a node hierarchy. | [
"RewriteFunc",
"rewrites",
"a",
"node",
"hierarchy",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L4023-L4025 |
133,054 | influxdata/influxql | ast.go | RewriteExpr | func RewriteExpr(expr Expr, fn func(Expr) Expr) Expr {
switch e := expr.(type) {
case *BinaryExpr:
e.LHS = RewriteExpr(e.LHS, fn)
e.RHS = RewriteExpr(e.RHS, fn)
if e.LHS != nil && e.RHS == nil {
expr = e.LHS
} else if e.RHS != nil && e.LHS == nil {
expr = e.RHS
} else if e.LHS == nil && e.RHS == nil {... | go | func RewriteExpr(expr Expr, fn func(Expr) Expr) Expr {
switch e := expr.(type) {
case *BinaryExpr:
e.LHS = RewriteExpr(e.LHS, fn)
e.RHS = RewriteExpr(e.RHS, fn)
if e.LHS != nil && e.RHS == nil {
expr = e.LHS
} else if e.RHS != nil && e.LHS == nil {
expr = e.RHS
} else if e.LHS == nil && e.RHS == nil {... | [
"func",
"RewriteExpr",
"(",
"expr",
"Expr",
",",
"fn",
"func",
"(",
"Expr",
")",
"Expr",
")",
"Expr",
"{",
"switch",
"e",
":=",
"expr",
".",
"(",
"type",
")",
"{",
"case",
"*",
"BinaryExpr",
":",
"e",
".",
"LHS",
"=",
"RewriteExpr",
"(",
"e",
"."... | // RewriteExpr recursively invokes the function to replace each expr.
// Nodes are traversed depth-first and rewritten from leaf to root. | [
"RewriteExpr",
"recursively",
"invokes",
"the",
"function",
"to",
"replace",
"each",
"expr",
".",
"Nodes",
"are",
"traversed",
"depth",
"-",
"first",
"and",
"rewritten",
"from",
"leaf",
"to",
"root",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L4033-L4059 |
133,055 | influxdata/influxql | ast.go | Eval | func Eval(expr Expr, m map[string]interface{}) interface{} {
eval := ValuerEval{Valuer: MapValuer(m)}
return eval.Eval(expr)
} | go | func Eval(expr Expr, m map[string]interface{}) interface{} {
eval := ValuerEval{Valuer: MapValuer(m)}
return eval.Eval(expr)
} | [
"func",
"Eval",
"(",
"expr",
"Expr",
",",
"m",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"interface",
"{",
"}",
"{",
"eval",
":=",
"ValuerEval",
"{",
"Valuer",
":",
"MapValuer",
"(",
"m",
")",
"}",
"\n",
"return",
"eval",
".",
"Eval",
... | // Eval evaluates expr against a map. | [
"Eval",
"evaluates",
"expr",
"against",
"a",
"map",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L4062-L4065 |
133,056 | influxdata/influxql | ast.go | Value | func (m MapValuer) Value(key string) (interface{}, bool) {
v, ok := m[key]
return v, ok
} | go | func (m MapValuer) Value(key string) (interface{}, bool) {
v, ok := m[key]
return v, ok
} | [
"func",
"(",
"m",
"MapValuer",
")",
"Value",
"(",
"key",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"bool",
")",
"{",
"v",
",",
"ok",
":=",
"m",
"[",
"key",
"]",
"\n",
"return",
"v",
",",
"ok",
"\n",
"}"
] | // Value returns the value for a key in the MapValuer. | [
"Value",
"returns",
"the",
"value",
"for",
"a",
"key",
"in",
"the",
"MapValuer",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L4071-L4074 |
133,057 | influxdata/influxql | ast.go | Eval | func (v *ValuerEval) Eval(expr Expr) interface{} {
if expr == nil {
return nil
}
switch expr := expr.(type) {
case *BinaryExpr:
return v.evalBinaryExpr(expr)
case *BooleanLiteral:
return expr.Val
case *IntegerLiteral:
return expr.Val
case *NumberLiteral:
return expr.Val
case *UnsignedLiteral:
retur... | go | func (v *ValuerEval) Eval(expr Expr) interface{} {
if expr == nil {
return nil
}
switch expr := expr.(type) {
case *BinaryExpr:
return v.evalBinaryExpr(expr)
case *BooleanLiteral:
return expr.Val
case *IntegerLiteral:
return expr.Val
case *NumberLiteral:
return expr.Val
case *UnsignedLiteral:
retur... | [
"func",
"(",
"v",
"*",
"ValuerEval",
")",
"Eval",
"(",
"expr",
"Expr",
")",
"interface",
"{",
"}",
"{",
"if",
"expr",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"switch",
"expr",
":=",
"expr",
".",
"(",
"type",
")",
"{",
"case",
"*",
... | // Eval evaluates an expression and returns a value. | [
"Eval",
"evaluates",
"an",
"expression",
"and",
"returns",
"a",
"value",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L4086-L4127 |
133,058 | influxdata/influxql | ast.go | EvalType | func (v *TypeValuerEval) EvalType(expr Expr) (DataType, error) {
switch expr := expr.(type) {
case *VarRef:
return v.evalVarRefExprType(expr)
case *Call:
return v.evalCallExprType(expr)
case *BinaryExpr:
return v.evalBinaryExprType(expr)
case *ParenExpr:
return v.EvalType(expr.Expr)
case *NumberLiteral:
... | go | func (v *TypeValuerEval) EvalType(expr Expr) (DataType, error) {
switch expr := expr.(type) {
case *VarRef:
return v.evalVarRefExprType(expr)
case *Call:
return v.evalCallExprType(expr)
case *BinaryExpr:
return v.evalBinaryExprType(expr)
case *ParenExpr:
return v.EvalType(expr.Expr)
case *NumberLiteral:
... | [
"func",
"(",
"v",
"*",
"TypeValuerEval",
")",
"EvalType",
"(",
"expr",
"Expr",
")",
"(",
"DataType",
",",
"error",
")",
"{",
"switch",
"expr",
":=",
"expr",
".",
"(",
"type",
")",
"{",
"case",
"*",
"VarRef",
":",
"return",
"v",
".",
"evalVarRefExprTy... | // EvalType returns the type for an expression. If the expression cannot
// be evaluated for some reason, like incompatible types, it is returned
// as a TypeError in the error. If the error is non-fatal so we can continue
// even though an error happened, true will be returned.
// This function assumes that the expres... | [
"EvalType",
"returns",
"the",
"type",
"for",
"an",
"expression",
".",
"If",
"the",
"expression",
"cannot",
"be",
"evaluated",
"for",
"some",
"reason",
"like",
"incompatible",
"types",
"it",
"is",
"returned",
"as",
"a",
"TypeError",
"in",
"the",
"error",
".",... | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L4576-L4598 |
133,059 | influxdata/influxql | ast.go | EvalType | func EvalType(expr Expr, sources Sources, typmap TypeMapper) DataType {
if typmap == nil {
typmap = nilTypeMapper{}
}
valuer := TypeValuerEval{
TypeMapper: typmap,
Sources: sources,
}
typ, _ := valuer.EvalType(expr)
return typ
} | go | func EvalType(expr Expr, sources Sources, typmap TypeMapper) DataType {
if typmap == nil {
typmap = nilTypeMapper{}
}
valuer := TypeValuerEval{
TypeMapper: typmap,
Sources: sources,
}
typ, _ := valuer.EvalType(expr)
return typ
} | [
"func",
"EvalType",
"(",
"expr",
"Expr",
",",
"sources",
"Sources",
",",
"typmap",
"TypeMapper",
")",
"DataType",
"{",
"if",
"typmap",
"==",
"nil",
"{",
"typmap",
"=",
"nilTypeMapper",
"{",
"}",
"\n",
"}",
"\n\n",
"valuer",
":=",
"TypeValuerEval",
"{",
"... | // EvalType evaluates the expression's type. | [
"EvalType",
"evaluates",
"the",
"expression",
"s",
"type",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L4745-L4756 |
133,060 | influxdata/influxql | ast.go | Reduce | func Reduce(expr Expr, valuer Valuer) Expr {
expr = reduce(expr, valuer)
// Unwrap parens at top level.
if expr, ok := expr.(*ParenExpr); ok {
return expr.Expr
}
return expr
} | go | func Reduce(expr Expr, valuer Valuer) Expr {
expr = reduce(expr, valuer)
// Unwrap parens at top level.
if expr, ok := expr.(*ParenExpr); ok {
return expr.Expr
}
return expr
} | [
"func",
"Reduce",
"(",
"expr",
"Expr",
",",
"valuer",
"Valuer",
")",
"Expr",
"{",
"expr",
"=",
"reduce",
"(",
"expr",
",",
"valuer",
")",
"\n\n",
"// Unwrap parens at top level.",
"if",
"expr",
",",
"ok",
":=",
"expr",
".",
"(",
"*",
"ParenExpr",
")",
... | // Reduce evaluates expr using the available values in valuer.
// References that don't exist in valuer are ignored. | [
"Reduce",
"evaluates",
"expr",
"using",
"the",
"available",
"values",
"in",
"valuer",
".",
"References",
"that",
"don",
"t",
"exist",
"in",
"valuer",
"are",
"ignored",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L4800-L4808 |
133,061 | influxdata/influxql | ast.go | asLiteral | func asLiteral(v interface{}) Literal {
switch v := v.(type) {
case bool:
return &BooleanLiteral{Val: v}
case time.Duration:
return &DurationLiteral{Val: v}
case float64:
return &NumberLiteral{Val: v}
case int64:
return &IntegerLiteral{Val: v}
case string:
return &StringLiteral{Val: v}
case time.Time:
... | go | func asLiteral(v interface{}) Literal {
switch v := v.(type) {
case bool:
return &BooleanLiteral{Val: v}
case time.Duration:
return &DurationLiteral{Val: v}
case float64:
return &NumberLiteral{Val: v}
case int64:
return &IntegerLiteral{Val: v}
case string:
return &StringLiteral{Val: v}
case time.Time:
... | [
"func",
"asLiteral",
"(",
"v",
"interface",
"{",
"}",
")",
"Literal",
"{",
"switch",
"v",
":=",
"v",
".",
"(",
"type",
")",
"{",
"case",
"bool",
":",
"return",
"&",
"BooleanLiteral",
"{",
"Val",
":",
"v",
"}",
"\n",
"case",
"time",
".",
"Duration",... | // asLiteral takes an interface and converts it into an influxql literal. | [
"asLiteral",
"takes",
"an",
"interface",
"and",
"converts",
"it",
"into",
"an",
"influxql",
"literal",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L5411-L5428 |
133,062 | influxdata/influxql | ast.go | Value | func (v *NowValuer) Value(key string) (interface{}, bool) {
if !v.Now.IsZero() && key == "now()" {
return v.Now, true
}
return nil, false
} | go | func (v *NowValuer) Value(key string) (interface{}, bool) {
if !v.Now.IsZero() && key == "now()" {
return v.Now, true
}
return nil, false
} | [
"func",
"(",
"v",
"*",
"NowValuer",
")",
"Value",
"(",
"key",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"bool",
")",
"{",
"if",
"!",
"v",
".",
"Now",
".",
"IsZero",
"(",
")",
"&&",
"key",
"==",
"\"",
"\"",
"{",
"return",
"v",
".",
"Now"... | // Value is a method that returns the value and existence flag for a given key. | [
"Value",
"is",
"a",
"method",
"that",
"returns",
"the",
"value",
"and",
"existence",
"flag",
"for",
"a",
"given",
"key",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L5469-L5474 |
133,063 | influxdata/influxql | ast.go | Zone | func (v *NowValuer) Zone() *time.Location {
if v.Location != nil {
return v.Location
}
return nil
} | go | func (v *NowValuer) Zone() *time.Location {
if v.Location != nil {
return v.Location
}
return nil
} | [
"func",
"(",
"v",
"*",
"NowValuer",
")",
"Zone",
"(",
")",
"*",
"time",
".",
"Location",
"{",
"if",
"v",
".",
"Location",
"!=",
"nil",
"{",
"return",
"v",
".",
"Location",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // Zone is a method that returns the time.Location. | [
"Zone",
"is",
"a",
"method",
"that",
"returns",
"the",
"time",
".",
"Location",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L5485-L5490 |
133,064 | influxdata/influxql | ast.go | ContainsVarRef | func ContainsVarRef(expr Expr) bool {
var v containsVarRefVisitor
Walk(&v, expr)
return v.contains
} | go | func ContainsVarRef(expr Expr) bool {
var v containsVarRefVisitor
Walk(&v, expr)
return v.contains
} | [
"func",
"ContainsVarRef",
"(",
"expr",
"Expr",
")",
"bool",
"{",
"var",
"v",
"containsVarRefVisitor",
"\n",
"Walk",
"(",
"&",
"v",
",",
"expr",
")",
"\n",
"return",
"v",
".",
"contains",
"\n",
"}"
] | // ContainsVarRef returns true if expr is a VarRef or contains one. | [
"ContainsVarRef",
"returns",
"true",
"if",
"expr",
"is",
"a",
"VarRef",
"or",
"contains",
"one",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L5535-L5539 |
133,065 | influxdata/influxql | ast.go | stringSetSlice | func stringSetSlice(m map[string]struct{}) []string {
if m == nil {
return nil
}
a := make([]string, 0, len(m))
for k := range m {
a = append(a, k)
}
sort.Strings(a)
return a
} | go | func stringSetSlice(m map[string]struct{}) []string {
if m == nil {
return nil
}
a := make([]string, 0, len(m))
for k := range m {
a = append(a, k)
}
sort.Strings(a)
return a
} | [
"func",
"stringSetSlice",
"(",
"m",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
")",
"[",
"]",
"string",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"a",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
... | // stringSetSlice returns a sorted slice of keys from a string set. | [
"stringSetSlice",
"returns",
"a",
"sorted",
"slice",
"of",
"keys",
"from",
"a",
"string",
"set",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L5566-L5577 |
133,066 | influxdata/influxql | ast.go | Intersect | func (t TimeRange) Intersect(other TimeRange) TimeRange {
if !other.Min.IsZero() {
if t.Min.IsZero() || other.Min.After(t.Min) {
t.Min = other.Min
}
}
if !other.Max.IsZero() {
if t.Max.IsZero() || other.Max.Before(t.Max) {
t.Max = other.Max
}
}
return t
} | go | func (t TimeRange) Intersect(other TimeRange) TimeRange {
if !other.Min.IsZero() {
if t.Min.IsZero() || other.Min.After(t.Min) {
t.Min = other.Min
}
}
if !other.Max.IsZero() {
if t.Max.IsZero() || other.Max.Before(t.Max) {
t.Max = other.Max
}
}
return t
} | [
"func",
"(",
"t",
"TimeRange",
")",
"Intersect",
"(",
"other",
"TimeRange",
")",
"TimeRange",
"{",
"if",
"!",
"other",
".",
"Min",
".",
"IsZero",
"(",
")",
"{",
"if",
"t",
".",
"Min",
".",
"IsZero",
"(",
")",
"||",
"other",
".",
"Min",
".",
"Afte... | // Intersect joins this TimeRange with another TimeRange. | [
"Intersect",
"joins",
"this",
"TimeRange",
"with",
"another",
"TimeRange",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L5585-L5597 |
133,067 | influxdata/influxql | ast.go | IsZero | func (t TimeRange) IsZero() bool {
return t.Min.IsZero() && t.Max.IsZero()
} | go | func (t TimeRange) IsZero() bool {
return t.Min.IsZero() && t.Max.IsZero()
} | [
"func",
"(",
"t",
"TimeRange",
")",
"IsZero",
"(",
")",
"bool",
"{",
"return",
"t",
".",
"Min",
".",
"IsZero",
"(",
")",
"&&",
"t",
".",
"Max",
".",
"IsZero",
"(",
")",
"\n",
"}"
] | // IsZero is true if the min and max of the time range are zero. | [
"IsZero",
"is",
"true",
"if",
"the",
"min",
"and",
"max",
"of",
"the",
"time",
"range",
"are",
"zero",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L5600-L5602 |
133,068 | influxdata/influxql | ast.go | MinTime | func (t TimeRange) MinTime() time.Time {
if t.Min.IsZero() {
return minTime
}
return t.Min
} | go | func (t TimeRange) MinTime() time.Time {
if t.Min.IsZero() {
return minTime
}
return t.Min
} | [
"func",
"(",
"t",
"TimeRange",
")",
"MinTime",
"(",
")",
"time",
".",
"Time",
"{",
"if",
"t",
".",
"Min",
".",
"IsZero",
"(",
")",
"{",
"return",
"minTime",
"\n",
"}",
"\n",
"return",
"t",
".",
"Min",
"\n",
"}"
] | // MinTime returns the minimum time of the TimeRange.
// If the minimum time is zero, this returns the minimum possible time. | [
"MinTime",
"returns",
"the",
"minimum",
"time",
"of",
"the",
"TimeRange",
".",
"If",
"the",
"minimum",
"time",
"is",
"zero",
"this",
"returns",
"the",
"minimum",
"possible",
"time",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L5610-L5615 |
133,069 | influxdata/influxql | ast.go | MaxTime | func (t TimeRange) MaxTime() time.Time {
if t.Max.IsZero() {
return maxTime
}
return t.Max
} | go | func (t TimeRange) MaxTime() time.Time {
if t.Max.IsZero() {
return maxTime
}
return t.Max
} | [
"func",
"(",
"t",
"TimeRange",
")",
"MaxTime",
"(",
")",
"time",
".",
"Time",
"{",
"if",
"t",
".",
"Max",
".",
"IsZero",
"(",
")",
"{",
"return",
"maxTime",
"\n",
"}",
"\n",
"return",
"t",
".",
"Max",
"\n",
"}"
] | // MaxTime returns the maximum time of the TimeRange.
// If the maximum time is zero, this returns the maximum possible time. | [
"MaxTime",
"returns",
"the",
"maximum",
"time",
"of",
"the",
"TimeRange",
".",
"If",
"the",
"maximum",
"time",
"is",
"zero",
"this",
"returns",
"the",
"maximum",
"possible",
"time",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L5619-L5624 |
133,070 | influxdata/influxql | ast.go | MinTimeNano | func (t TimeRange) MinTimeNano() int64 {
if t.Min.IsZero() {
return MinTime
}
return t.Min.UnixNano()
} | go | func (t TimeRange) MinTimeNano() int64 {
if t.Min.IsZero() {
return MinTime
}
return t.Min.UnixNano()
} | [
"func",
"(",
"t",
"TimeRange",
")",
"MinTimeNano",
"(",
")",
"int64",
"{",
"if",
"t",
".",
"Min",
".",
"IsZero",
"(",
")",
"{",
"return",
"MinTime",
"\n",
"}",
"\n",
"return",
"t",
".",
"Min",
".",
"UnixNano",
"(",
")",
"\n",
"}"
] | // MinTimeNano returns the minimum time in nanoseconds since the epoch.
// If the minimum time is zero, this returns the minimum possible time. | [
"MinTimeNano",
"returns",
"the",
"minimum",
"time",
"in",
"nanoseconds",
"since",
"the",
"epoch",
".",
"If",
"the",
"minimum",
"time",
"is",
"zero",
"this",
"returns",
"the",
"minimum",
"possible",
"time",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L5628-L5633 |
133,071 | influxdata/influxql | ast.go | MaxTimeNano | func (t TimeRange) MaxTimeNano() int64 {
if t.Max.IsZero() {
return MaxTime
}
return t.Max.UnixNano()
} | go | func (t TimeRange) MaxTimeNano() int64 {
if t.Max.IsZero() {
return MaxTime
}
return t.Max.UnixNano()
} | [
"func",
"(",
"t",
"TimeRange",
")",
"MaxTimeNano",
"(",
")",
"int64",
"{",
"if",
"t",
".",
"Max",
".",
"IsZero",
"(",
")",
"{",
"return",
"MaxTime",
"\n",
"}",
"\n",
"return",
"t",
".",
"Max",
".",
"UnixNano",
"(",
")",
"\n",
"}"
] | // MaxTimeNano returns the maximum time in nanoseconds since the epoch.
// If the maximum time is zero, this returns the maximum possible time. | [
"MaxTimeNano",
"returns",
"the",
"maximum",
"time",
"in",
"nanoseconds",
"since",
"the",
"epoch",
".",
"If",
"the",
"maximum",
"time",
"is",
"zero",
"this",
"returns",
"the",
"maximum",
"possible",
"time",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L5637-L5642 |
133,072 | influxdata/influxql | ast.go | ConditionExpr | func ConditionExpr(cond Expr, valuer Valuer) (Expr, TimeRange, error) {
expr, tr, err := conditionExpr(cond, valuer)
// Remove top level parentheses
if e, ok := expr.(*ParenExpr); ok {
expr = e.Expr
}
if e, ok := expr.(*BooleanLiteral); ok && e.Val {
// If the condition is true, return nil instead to indicat... | go | func ConditionExpr(cond Expr, valuer Valuer) (Expr, TimeRange, error) {
expr, tr, err := conditionExpr(cond, valuer)
// Remove top level parentheses
if e, ok := expr.(*ParenExpr); ok {
expr = e.Expr
}
if e, ok := expr.(*BooleanLiteral); ok && e.Val {
// If the condition is true, return nil instead to indicat... | [
"func",
"ConditionExpr",
"(",
"cond",
"Expr",
",",
"valuer",
"Valuer",
")",
"(",
"Expr",
",",
"TimeRange",
",",
"error",
")",
"{",
"expr",
",",
"tr",
",",
"err",
":=",
"conditionExpr",
"(",
"cond",
",",
"valuer",
")",
"\n\n",
"// Remove top level parenthes... | // ConditionExpr extracts the time range and the condition from an expression.
// We only support simple time ranges that are constrained with AND and are not nested.
// This throws an error when we encounter a time condition that is combined with OR
// to prevent returning unexpected results that we do not support. | [
"ConditionExpr",
"extracts",
"the",
"time",
"range",
"and",
"the",
"condition",
"from",
"an",
"expression",
".",
"We",
"only",
"support",
"simple",
"time",
"ranges",
"that",
"are",
"constrained",
"with",
"AND",
"and",
"are",
"not",
"nested",
".",
"This",
"th... | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L5648-L5662 |
133,073 | influxdata/influxql | ast.go | getTimeRange | func getTimeRange(op Token, rhs Expr, valuer Valuer) (TimeRange, error) {
// If literal looks like a date time then parse it as a time literal.
if strlit, ok := rhs.(*StringLiteral); ok {
if strlit.IsTimeLiteral() {
var loc *time.Location
if valuer, ok := valuer.(ZoneValuer); ok {
loc = valuer.Zone()
}... | go | func getTimeRange(op Token, rhs Expr, valuer Valuer) (TimeRange, error) {
// If literal looks like a date time then parse it as a time literal.
if strlit, ok := rhs.(*StringLiteral); ok {
if strlit.IsTimeLiteral() {
var loc *time.Location
if valuer, ok := valuer.(ZoneValuer); ok {
loc = valuer.Zone()
}... | [
"func",
"getTimeRange",
"(",
"op",
"Token",
",",
"rhs",
"Expr",
",",
"valuer",
"Valuer",
")",
"(",
"TimeRange",
",",
"error",
")",
"{",
"// If literal looks like a date time then parse it as a time literal.",
"if",
"strlit",
",",
"ok",
":=",
"rhs",
".",
"(",
"*"... | // getTimeRange returns the time range associated with this comparison.
// op is the operation that is used for comparison and rhs is the right hand side
// of the expression. The left hand side is always assumed to be "time". | [
"getTimeRange",
"returns",
"the",
"time",
"range",
"associated",
"with",
"this",
"comparison",
".",
"op",
"is",
"the",
"operation",
"that",
"is",
"used",
"for",
"comparison",
"and",
"rhs",
"is",
"the",
"right",
"hand",
"side",
"of",
"the",
"expression",
".",... | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/ast.go#L5739-L5795 |
133,074 | influxdata/influxql | parser.go | ParseStatement | func ParseStatement(s string) (Statement, error) {
return NewParser(strings.NewReader(s)).ParseStatement()
} | go | func ParseStatement(s string) (Statement, error) {
return NewParser(strings.NewReader(s)).ParseStatement()
} | [
"func",
"ParseStatement",
"(",
"s",
"string",
")",
"(",
"Statement",
",",
"error",
")",
"{",
"return",
"NewParser",
"(",
"strings",
".",
"NewReader",
"(",
"s",
")",
")",
".",
"ParseStatement",
"(",
")",
"\n",
"}"
] | // ParseStatement parses a statement string and returns its AST representation. | [
"ParseStatement",
"parses",
"a",
"statement",
"string",
"and",
"returns",
"its",
"AST",
"representation",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L43-L45 |
133,075 | influxdata/influxql | parser.go | MustParseStatement | func MustParseStatement(s string) Statement {
stmt, err := ParseStatement(s)
if err != nil {
panic(err.Error())
}
return stmt
} | go | func MustParseStatement(s string) Statement {
stmt, err := ParseStatement(s)
if err != nil {
panic(err.Error())
}
return stmt
} | [
"func",
"MustParseStatement",
"(",
"s",
"string",
")",
"Statement",
"{",
"stmt",
",",
"err",
":=",
"ParseStatement",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"s... | // MustParseStatement parses a statement string and returns its AST. Panic on error. | [
"MustParseStatement",
"parses",
"a",
"statement",
"string",
"and",
"returns",
"its",
"AST",
".",
"Panic",
"on",
"error",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L48-L54 |
133,076 | influxdata/influxql | parser.go | MustParseExpr | func MustParseExpr(s string) Expr {
expr, err := ParseExpr(s)
if err != nil {
panic(err.Error())
}
return expr
} | go | func MustParseExpr(s string) Expr {
expr, err := ParseExpr(s)
if err != nil {
panic(err.Error())
}
return expr
} | [
"func",
"MustParseExpr",
"(",
"s",
"string",
")",
"Expr",
"{",
"expr",
",",
"err",
":=",
"ParseExpr",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"expr",
"\n",
... | // MustParseExpr parses an expression string and returns its AST. Panic on error. | [
"MustParseExpr",
"parses",
"an",
"expression",
"string",
"and",
"returns",
"its",
"AST",
".",
"Panic",
"on",
"error",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L60-L66 |
133,077 | influxdata/influxql | parser.go | ParseQuery | func (p *Parser) ParseQuery() (*Query, error) {
var statements Statements
semi := true
for {
if tok, pos, lit := p.ScanIgnoreWhitespace(); tok == EOF {
return &Query{Statements: statements}, nil
} else if tok == SEMICOLON {
semi = true
} else {
if !semi {
return nil, newParseError(tokstr(tok, lit... | go | func (p *Parser) ParseQuery() (*Query, error) {
var statements Statements
semi := true
for {
if tok, pos, lit := p.ScanIgnoreWhitespace(); tok == EOF {
return &Query{Statements: statements}, nil
} else if tok == SEMICOLON {
semi = true
} else {
if !semi {
return nil, newParseError(tokstr(tok, lit... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"ParseQuery",
"(",
")",
"(",
"*",
"Query",
",",
"error",
")",
"{",
"var",
"statements",
"Statements",
"\n",
"semi",
":=",
"true",
"\n\n",
"for",
"{",
"if",
"tok",
",",
"pos",
",",
"lit",
":=",
"p",
".",
"Scan... | // ParseQuery parses an InfluxQL string and returns a Query AST object. | [
"ParseQuery",
"parses",
"an",
"InfluxQL",
"string",
"and",
"returns",
"a",
"Query",
"AST",
"object",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L69-L91 |
133,078 | influxdata/influxql | parser.go | parseSetPasswordUserStatement | func (p *Parser) parseSetPasswordUserStatement() (*SetPasswordUserStatement, error) {
stmt := &SetPasswordUserStatement{}
// Parse username
ident, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = ident
// Consume the required = token.
if tok, pos, lit := p.ScanIgnoreWhitespace(); tok != ... | go | func (p *Parser) parseSetPasswordUserStatement() (*SetPasswordUserStatement, error) {
stmt := &SetPasswordUserStatement{}
// Parse username
ident, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = ident
// Consume the required = token.
if tok, pos, lit := p.ScanIgnoreWhitespace(); tok != ... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseSetPasswordUserStatement",
"(",
")",
"(",
"*",
"SetPasswordUserStatement",
",",
"error",
")",
"{",
"stmt",
":=",
"&",
"SetPasswordUserStatement",
"{",
"}",
"\n\n",
"// Parse username",
"ident",
",",
"err",
":=",
"p",... | // parseSetPasswordUserStatement parses a string and returns a set statement.
// This function assumes the SET token has already been consumed. | [
"parseSetPasswordUserStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"set",
"statement",
".",
"This",
"function",
"assumes",
"the",
"SET",
"token",
"has",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L100-L123 |
133,079 | influxdata/influxql | parser.go | parseKillQueryStatement | func (p *Parser) parseKillQueryStatement() (*KillQueryStatement, error) {
qid, err := p.ParseUInt64()
if err != nil {
return nil, err
}
var host string
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == ON {
host, err = p.ParseIdent()
if err != nil {
return nil, err
}
} else {
p.Unscan()
}
return &K... | go | func (p *Parser) parseKillQueryStatement() (*KillQueryStatement, error) {
qid, err := p.ParseUInt64()
if err != nil {
return nil, err
}
var host string
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == ON {
host, err = p.ParseIdent()
if err != nil {
return nil, err
}
} else {
p.Unscan()
}
return &K... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseKillQueryStatement",
"(",
")",
"(",
"*",
"KillQueryStatement",
",",
"error",
")",
"{",
"qid",
",",
"err",
":=",
"p",
".",
"ParseUInt64",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
... | // parseKillQueryStatement parses a string and returns a kill statement.
// This function assumes the KILL token has already been consumed. | [
"parseKillQueryStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"kill",
"statement",
".",
"This",
"function",
"assumes",
"the",
"KILL",
"token",
"has",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L127-L143 |
133,080 | influxdata/influxql | parser.go | parseCreateSubscriptionStatement | func (p *Parser) parseCreateSubscriptionStatement() (*CreateSubscriptionStatement, error) {
stmt := &CreateSubscriptionStatement{}
// Read the id of the subscription to create.
ident, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = ident
// Expect an "ON" keyword.
if tok, pos, lit := p.S... | go | func (p *Parser) parseCreateSubscriptionStatement() (*CreateSubscriptionStatement, error) {
stmt := &CreateSubscriptionStatement{}
// Read the id of the subscription to create.
ident, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = ident
// Expect an "ON" keyword.
if tok, pos, lit := p.S... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseCreateSubscriptionStatement",
"(",
")",
"(",
"*",
"CreateSubscriptionStatement",
",",
"error",
")",
"{",
"stmt",
":=",
"&",
"CreateSubscriptionStatement",
"{",
"}",
"\n\n",
"// Read the id of the subscription to create.",
"i... | // parseCreateSubscriptionStatement parses a string and returns a CreateSubscriptionStatement.
// This function assumes the "CREATE SUBSCRIPTION" tokens have already been consumed. | [
"parseCreateSubscriptionStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"CreateSubscriptionStatement",
".",
"This",
"function",
"assumes",
"the",
"CREATE",
"SUBSCRIPTION",
"tokens",
"have",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L147-L198 |
133,081 | influxdata/influxql | parser.go | parseCreateRetentionPolicyStatement | func (p *Parser) parseCreateRetentionPolicyStatement() (*CreateRetentionPolicyStatement, error) {
stmt := &CreateRetentionPolicyStatement{}
// Parse the retention policy name.
ident, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = ident
// Consume the required ON token.
if tok, pos, lit ... | go | func (p *Parser) parseCreateRetentionPolicyStatement() (*CreateRetentionPolicyStatement, error) {
stmt := &CreateRetentionPolicyStatement{}
// Parse the retention policy name.
ident, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = ident
// Consume the required ON token.
if tok, pos, lit ... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseCreateRetentionPolicyStatement",
"(",
")",
"(",
"*",
"CreateRetentionPolicyStatement",
",",
"error",
")",
"{",
"stmt",
":=",
"&",
"CreateRetentionPolicyStatement",
"{",
"}",
"\n\n",
"// Parse the retention policy name.",
"id... | // parseCreateRetentionPolicyStatement parses a string and returns a create retention policy statement.
// This function assumes the CREATE RETENTION POLICY tokens have already been consumed. | [
"parseCreateRetentionPolicyStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"create",
"retention",
"policy",
"statement",
".",
"This",
"function",
"assumes",
"the",
"CREATE",
"RETENTION",
"POLICY",
"tokens",
"have",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L202-L281 |
133,082 | influxdata/influxql | parser.go | parseAlterRetentionPolicyStatement | func (p *Parser) parseAlterRetentionPolicyStatement() (*AlterRetentionPolicyStatement, error) {
stmt := &AlterRetentionPolicyStatement{}
// Parse the retention policy name.
tok, pos, lit := p.ScanIgnoreWhitespace()
if tok == DEFAULT {
stmt.Name = "default"
} else if tok == IDENT {
stmt.Name = lit
} else {
... | go | func (p *Parser) parseAlterRetentionPolicyStatement() (*AlterRetentionPolicyStatement, error) {
stmt := &AlterRetentionPolicyStatement{}
// Parse the retention policy name.
tok, pos, lit := p.ScanIgnoreWhitespace()
if tok == DEFAULT {
stmt.Name = "default"
} else if tok == IDENT {
stmt.Name = lit
} else {
... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseAlterRetentionPolicyStatement",
"(",
")",
"(",
"*",
"AlterRetentionPolicyStatement",
",",
"error",
")",
"{",
"stmt",
":=",
"&",
"AlterRetentionPolicyStatement",
"{",
"}",
"\n\n",
"// Parse the retention policy name.",
"tok",... | // parseAlterRetentionPolicyStatement parses a string and returns an alter retention policy statement.
// This function assumes the ALTER RETENTION POLICY tokens have already been consumed. | [
"parseAlterRetentionPolicyStatement",
"parses",
"a",
"string",
"and",
"returns",
"an",
"alter",
"retention",
"policy",
"statement",
".",
"This",
"function",
"assumes",
"the",
"ALTER",
"RETENTION",
"POLICY",
"tokens",
"have",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L285-L369 |
133,083 | influxdata/influxql | parser.go | ParseUInt64 | func (p *Parser) ParseUInt64() (uint64, error) {
tok, pos, lit := p.ScanIgnoreWhitespace()
if tok != INTEGER {
return 0, newParseError(tokstr(tok, lit), []string{"integer"}, pos)
}
// Convert string to unsigned 64-bit integer
n, err := strconv.ParseUint(lit, 10, 64)
if err != nil {
return 0, &ParseError{Mess... | go | func (p *Parser) ParseUInt64() (uint64, error) {
tok, pos, lit := p.ScanIgnoreWhitespace()
if tok != INTEGER {
return 0, newParseError(tokstr(tok, lit), []string{"integer"}, pos)
}
// Convert string to unsigned 64-bit integer
n, err := strconv.ParseUint(lit, 10, 64)
if err != nil {
return 0, &ParseError{Mess... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"ParseUInt64",
"(",
")",
"(",
"uint64",
",",
"error",
")",
"{",
"tok",
",",
"pos",
",",
"lit",
":=",
"p",
".",
"ScanIgnoreWhitespace",
"(",
")",
"\n",
"if",
"tok",
"!=",
"INTEGER",
"{",
"return",
"0",
",",
"n... | // ParseUInt64 parses a string and returns a 64-bit unsigned integer literal. | [
"ParseUInt64",
"parses",
"a",
"string",
"and",
"returns",
"a",
"64",
"-",
"bit",
"unsigned",
"integer",
"literal",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L394-L407 |
133,084 | influxdata/influxql | parser.go | ParseDuration | func (p *Parser) ParseDuration() (time.Duration, error) {
tok, pos, lit := p.ScanIgnoreWhitespace()
if tok != DURATIONVAL && tok != INF {
return 0, newParseError(tokstr(tok, lit), []string{"duration"}, pos)
}
if tok == INF {
return 0, nil
}
d, err := ParseDuration(lit)
if err != nil {
return 0, &ParseErr... | go | func (p *Parser) ParseDuration() (time.Duration, error) {
tok, pos, lit := p.ScanIgnoreWhitespace()
if tok != DURATIONVAL && tok != INF {
return 0, newParseError(tokstr(tok, lit), []string{"duration"}, pos)
}
if tok == INF {
return 0, nil
}
d, err := ParseDuration(lit)
if err != nil {
return 0, &ParseErr... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"ParseDuration",
"(",
")",
"(",
"time",
".",
"Duration",
",",
"error",
")",
"{",
"tok",
",",
"pos",
",",
"lit",
":=",
"p",
".",
"ScanIgnoreWhitespace",
"(",
")",
"\n",
"if",
"tok",
"!=",
"DURATIONVAL",
"&&",
"t... | // ParseDuration parses a string and returns a duration literal.
// This function assumes the DURATION token has already been consumed. | [
"ParseDuration",
"parses",
"a",
"string",
"and",
"returns",
"a",
"duration",
"literal",
".",
"This",
"function",
"assumes",
"the",
"DURATION",
"token",
"has",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L411-L427 |
133,085 | influxdata/influxql | parser.go | ParseIdent | func (p *Parser) ParseIdent() (string, error) {
tok, pos, lit := p.ScanIgnoreWhitespace()
if tok != IDENT {
return "", newParseError(tokstr(tok, lit), []string{"identifier"}, pos)
}
return lit, nil
} | go | func (p *Parser) ParseIdent() (string, error) {
tok, pos, lit := p.ScanIgnoreWhitespace()
if tok != IDENT {
return "", newParseError(tokstr(tok, lit), []string{"identifier"}, pos)
}
return lit, nil
} | [
"func",
"(",
"p",
"*",
"Parser",
")",
"ParseIdent",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"tok",
",",
"pos",
",",
"lit",
":=",
"p",
".",
"ScanIgnoreWhitespace",
"(",
")",
"\n",
"if",
"tok",
"!=",
"IDENT",
"{",
"return",
"\"",
"\"",
","... | // ParseIdent parses an identifier. | [
"ParseIdent",
"parses",
"an",
"identifier",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L430-L436 |
133,086 | influxdata/influxql | parser.go | ParseIdentList | func (p *Parser) ParseIdentList() ([]string, error) {
// Parse first (required) identifier.
ident, err := p.ParseIdent()
if err != nil {
return nil, err
}
idents := []string{ident}
// Parse remaining (optional) identifiers.
for {
if tok, _, _ := p.ScanIgnoreWhitespace(); tok != COMMA {
p.Unscan()
retu... | go | func (p *Parser) ParseIdentList() ([]string, error) {
// Parse first (required) identifier.
ident, err := p.ParseIdent()
if err != nil {
return nil, err
}
idents := []string{ident}
// Parse remaining (optional) identifiers.
for {
if tok, _, _ := p.ScanIgnoreWhitespace(); tok != COMMA {
p.Unscan()
retu... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"ParseIdentList",
"(",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"// Parse first (required) identifier.",
"ident",
",",
"err",
":=",
"p",
".",
"ParseIdent",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{"... | // ParseIdentList parses a comma delimited list of identifiers. | [
"ParseIdentList",
"parses",
"a",
"comma",
"delimited",
"list",
"of",
"identifiers",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L439-L460 |
133,087 | influxdata/influxql | parser.go | parseString | func (p *Parser) parseString() (string, error) {
tok, pos, lit := p.ScanIgnoreWhitespace()
if tok != STRING {
return "", newParseError(tokstr(tok, lit), []string{"string"}, pos)
}
return lit, nil
} | go | func (p *Parser) parseString() (string, error) {
tok, pos, lit := p.ScanIgnoreWhitespace()
if tok != STRING {
return "", newParseError(tokstr(tok, lit), []string{"string"}, pos)
}
return lit, nil
} | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseString",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"tok",
",",
"pos",
",",
"lit",
":=",
"p",
".",
"ScanIgnoreWhitespace",
"(",
")",
"\n",
"if",
"tok",
"!=",
"STRING",
"{",
"return",
"\"",
"\"",
"... | // parseString parses a string. | [
"parseString",
"parses",
"a",
"string",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L508-L514 |
133,088 | influxdata/influxql | parser.go | parseStringList | func (p *Parser) parseStringList() ([]string, error) {
// Parse first (required) string.
str, err := p.parseString()
if err != nil {
return nil, err
}
strs := []string{str}
// Parse remaining (optional) strings.
for {
if tok, _, _ := p.ScanIgnoreWhitespace(); tok != COMMA {
p.Unscan()
return strs, nil... | go | func (p *Parser) parseStringList() ([]string, error) {
// Parse first (required) string.
str, err := p.parseString()
if err != nil {
return nil, err
}
strs := []string{str}
// Parse remaining (optional) strings.
for {
if tok, _, _ := p.ScanIgnoreWhitespace(); tok != COMMA {
p.Unscan()
return strs, nil... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseStringList",
"(",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"// Parse first (required) string.",
"str",
",",
"err",
":=",
"p",
".",
"parseString",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // parseStringList parses a list of strings separated by commas. | [
"parseStringList",
"parses",
"a",
"list",
"of",
"strings",
"separated",
"by",
"commas",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L517-L538 |
133,089 | influxdata/influxql | parser.go | parseRevokeStatement | func (p *Parser) parseRevokeStatement() (Statement, error) {
// Parse the privilege to be revoked.
priv, err := p.parsePrivilege()
if err != nil {
return nil, err
}
// Check for ON or FROM clauses.
tok, pos, lit := p.ScanIgnoreWhitespace()
if tok == ON {
stmt, err := p.parseRevokeOnStatement()
if err != n... | go | func (p *Parser) parseRevokeStatement() (Statement, error) {
// Parse the privilege to be revoked.
priv, err := p.parsePrivilege()
if err != nil {
return nil, err
}
// Check for ON or FROM clauses.
tok, pos, lit := p.ScanIgnoreWhitespace()
if tok == ON {
stmt, err := p.parseRevokeOnStatement()
if err != n... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseRevokeStatement",
"(",
")",
"(",
"Statement",
",",
"error",
")",
"{",
"// Parse the privilege to be revoked.",
"priv",
",",
"err",
":=",
"p",
".",
"parsePrivilege",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // parseRevokeStatement parses a string and returns a revoke statement.
// This function assumes the REVOKE token has already been consumed. | [
"parseRevokeStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"revoke",
"statement",
".",
"This",
"function",
"assumes",
"the",
"REVOKE",
"token",
"has",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L542-L571 |
133,090 | influxdata/influxql | parser.go | parseGrantStatement | func (p *Parser) parseGrantStatement() (Statement, error) {
// Parse the privilege to be granted.
priv, err := p.parsePrivilege()
if err != nil {
return nil, err
}
// Check for ON or TO clauses.
tok, pos, lit := p.ScanIgnoreWhitespace()
if tok == ON {
stmt, err := p.parseGrantOnStatement()
if err != nil {... | go | func (p *Parser) parseGrantStatement() (Statement, error) {
// Parse the privilege to be granted.
priv, err := p.parsePrivilege()
if err != nil {
return nil, err
}
// Check for ON or TO clauses.
tok, pos, lit := p.ScanIgnoreWhitespace()
if tok == ON {
stmt, err := p.parseGrantOnStatement()
if err != nil {... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseGrantStatement",
"(",
")",
"(",
"Statement",
",",
"error",
")",
"{",
"// Parse the privilege to be granted.",
"priv",
",",
"err",
":=",
"p",
".",
"parsePrivilege",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // parseGrantStatement parses a string and returns a grant statement.
// This function assumes the GRANT token has already been consumed. | [
"parseGrantStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"grant",
"statement",
".",
"This",
"function",
"assumes",
"the",
"GRANT",
"token",
"has",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L621-L650 |
133,091 | influxdata/influxql | parser.go | parsePrivilege | func (p *Parser) parsePrivilege() (Privilege, error) {
tok, pos, lit := p.ScanIgnoreWhitespace()
switch tok {
case READ:
return ReadPrivilege, nil
case WRITE:
return WritePrivilege, nil
case ALL:
// Consume optional PRIVILEGES token
tok, pos, lit = p.ScanIgnoreWhitespace()
if tok != PRIVILEGES {
p.Uns... | go | func (p *Parser) parsePrivilege() (Privilege, error) {
tok, pos, lit := p.ScanIgnoreWhitespace()
switch tok {
case READ:
return ReadPrivilege, nil
case WRITE:
return WritePrivilege, nil
case ALL:
// Consume optional PRIVILEGES token
tok, pos, lit = p.ScanIgnoreWhitespace()
if tok != PRIVILEGES {
p.Uns... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parsePrivilege",
"(",
")",
"(",
"Privilege",
",",
"error",
")",
"{",
"tok",
",",
"pos",
",",
"lit",
":=",
"p",
".",
"ScanIgnoreWhitespace",
"(",
")",
"\n",
"switch",
"tok",
"{",
"case",
"READ",
":",
"return",
... | // parsePrivilege parses a string and returns a Privilege. | [
"parsePrivilege",
"parses",
"a",
"string",
"and",
"returns",
"a",
"Privilege",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L699-L715 |
133,092 | influxdata/influxql | parser.go | parseSelectStatement | func (p *Parser) parseSelectStatement(tr targetRequirement) (*SelectStatement, error) {
stmt := &SelectStatement{}
var err error
// Parse fields: "FIELD+".
if stmt.Fields, err = p.parseFields(); err != nil {
return nil, err
}
// Parse target: "INTO"
if stmt.Target, err = p.parseTarget(tr); err != nil {
ret... | go | func (p *Parser) parseSelectStatement(tr targetRequirement) (*SelectStatement, error) {
stmt := &SelectStatement{}
var err error
// Parse fields: "FIELD+".
if stmt.Fields, err = p.parseFields(); err != nil {
return nil, err
}
// Parse target: "INTO"
if stmt.Target, err = p.parseTarget(tr); err != nil {
ret... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseSelectStatement",
"(",
"tr",
"targetRequirement",
")",
"(",
"*",
"SelectStatement",
",",
"error",
")",
"{",
"stmt",
":=",
"&",
"SelectStatement",
"{",
"}",
"\n",
"var",
"err",
"error",
"\n\n",
"// Parse fields: \"F... | // parseSelectStatement parses a select string and returns a Statement AST object.
// This function assumes the SELECT token has already been consumed. | [
"parseSelectStatement",
"parses",
"a",
"select",
"string",
"and",
"returns",
"a",
"Statement",
"AST",
"object",
".",
"This",
"function",
"assumes",
"the",
"SELECT",
"token",
"has",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L719-L795 |
133,093 | influxdata/influxql | parser.go | parseTarget | func (p *Parser) parseTarget(tr targetRequirement) (*Target, error) {
if tok, pos, lit := p.ScanIgnoreWhitespace(); tok != INTO {
if tr == targetRequired {
return nil, newParseError(tokstr(tok, lit), []string{"INTO"}, pos)
}
p.Unscan()
return nil, nil
}
// db, rp, and / or measurement
idents, err := p.p... | go | func (p *Parser) parseTarget(tr targetRequirement) (*Target, error) {
if tok, pos, lit := p.ScanIgnoreWhitespace(); tok != INTO {
if tr == targetRequired {
return nil, newParseError(tokstr(tok, lit), []string{"INTO"}, pos)
}
p.Unscan()
return nil, nil
}
// db, rp, and / or measurement
idents, err := p.p... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseTarget",
"(",
"tr",
"targetRequirement",
")",
"(",
"*",
"Target",
",",
"error",
")",
"{",
"if",
"tok",
",",
"pos",
",",
"lit",
":=",
"p",
".",
"ScanIgnoreWhitespace",
"(",
")",
";",
"tok",
"!=",
"INTO",
"... | // parseTarget parses a string and returns a Target. | [
"parseTarget",
"parses",
"a",
"string",
"and",
"returns",
"a",
"Target",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L807-L848 |
133,094 | influxdata/influxql | parser.go | parseDeleteStatement | func (p *Parser) parseDeleteStatement() (Statement, error) {
stmt := &DeleteSeriesStatement{}
var err error
tok, pos, lit := p.ScanIgnoreWhitespace()
if tok == FROM {
// Parse source.
if stmt.Sources, err = p.parseSources(false); err != nil {
return nil, err
}
var err error
WalkFunc(stmt.Sources, fu... | go | func (p *Parser) parseDeleteStatement() (Statement, error) {
stmt := &DeleteSeriesStatement{}
var err error
tok, pos, lit := p.ScanIgnoreWhitespace()
if tok == FROM {
// Parse source.
if stmt.Sources, err = p.parseSources(false); err != nil {
return nil, err
}
var err error
WalkFunc(stmt.Sources, fu... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseDeleteStatement",
"(",
")",
"(",
"Statement",
",",
"error",
")",
"{",
"stmt",
":=",
"&",
"DeleteSeriesStatement",
"{",
"}",
"\n",
"var",
"err",
"error",
"\n\n",
"tok",
",",
"pos",
",",
"lit",
":=",
"p",
"."... | // parseDeleteStatement parses a string and returns a delete statement.
// This function assumes the DELETE token has already been consumed. | [
"parseDeleteStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"delete",
"statement",
".",
"This",
"function",
"assumes",
"the",
"DELETE",
"token",
"has",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L852-L897 |
133,095 | influxdata/influxql | parser.go | parseShowSeriesStatement | func (p *Parser) parseShowSeriesStatement() (Statement, error) {
var exactCardinality bool
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == EXACT {
exactCardinality = true
} else {
p.Unscan()
}
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == CARDINALITY {
return p.parseShowSeriesCardinalityStatement(exactC... | go | func (p *Parser) parseShowSeriesStatement() (Statement, error) {
var exactCardinality bool
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == EXACT {
exactCardinality = true
} else {
p.Unscan()
}
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == CARDINALITY {
return p.parseShowSeriesCardinalityStatement(exactC... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseShowSeriesStatement",
"(",
")",
"(",
"Statement",
",",
"error",
")",
"{",
"var",
"exactCardinality",
"bool",
"\n",
"if",
"tok",
",",
"_",
",",
"_",
":=",
"p",
".",
"ScanIgnoreWhitespace",
"(",
")",
";",
"tok"... | // parseShowSeriesStatement parses a string and returns a Statement.
// This function assumes the "SHOW SERIES" tokens have already been consumed. | [
"parseShowSeriesStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"Statement",
".",
"This",
"function",
"assumes",
"the",
"SHOW",
"SERIES",
"tokens",
"have",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L901-L960 |
133,096 | influxdata/influxql | parser.go | parseShowSeriesCardinalityStatement | func (p *Parser) parseShowSeriesCardinalityStatement(exact bool) (Statement, error) {
var err error
stmt := &ShowSeriesCardinalityStatement{Exact: exact}
// Parse optional ON clause.
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == ON {
if stmt.Database, err = p.ParseIdent(); err != nil {
return nil, err
}
... | go | func (p *Parser) parseShowSeriesCardinalityStatement(exact bool) (Statement, error) {
var err error
stmt := &ShowSeriesCardinalityStatement{Exact: exact}
// Parse optional ON clause.
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == ON {
if stmt.Database, err = p.ParseIdent(); err != nil {
return nil, err
}
... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseShowSeriesCardinalityStatement",
"(",
"exact",
"bool",
")",
"(",
"Statement",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n",
"stmt",
":=",
"&",
"ShowSeriesCardinalityStatement",
"{",
"Exact",
":",
"exact",
"}... | // This function assumes the "SHOW SERIES EXACT CARDINALITY" or the
// "SHOW SERIES CARDINALITY" tokens have already been consumed. | [
"This",
"function",
"assumes",
"the",
"SHOW",
"SERIES",
"EXACT",
"CARDINALITY",
"or",
"the",
"SHOW",
"SERIES",
"CARDINALITY",
"tokens",
"have",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L964-L1004 |
133,097 | influxdata/influxql | parser.go | parseShowMeasurementsStatement | func (p *Parser) parseShowMeasurementsStatement() (*ShowMeasurementsStatement, error) {
stmt := &ShowMeasurementsStatement{}
var err error
// Parse optional ON clause.
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == ON {
// Parse the database.
stmt.Database, err = p.ParseIdent()
if err != nil {
return ni... | go | func (p *Parser) parseShowMeasurementsStatement() (*ShowMeasurementsStatement, error) {
stmt := &ShowMeasurementsStatement{}
var err error
// Parse optional ON clause.
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == ON {
// Parse the database.
stmt.Database, err = p.ParseIdent()
if err != nil {
return ni... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseShowMeasurementsStatement",
"(",
")",
"(",
"*",
"ShowMeasurementsStatement",
",",
"error",
")",
"{",
"stmt",
":=",
"&",
"ShowMeasurementsStatement",
"{",
"}",
"\n",
"var",
"err",
"error",
"\n\n",
"// Parse optional ON ... | // parseShowMeasurementsStatement parses a string and returns a Statement.
// This function assumes the "SHOW MEASUREMENTS" tokens have already been consumed. | [
"parseShowMeasurementsStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"Statement",
".",
"This",
"function",
"assumes",
"the",
"SHOW",
"MEASUREMENTS",
"tokens",
"have",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L1058-L1117 |
133,098 | influxdata/influxql | parser.go | parseShowRetentionPoliciesStatement | func (p *Parser) parseShowRetentionPoliciesStatement() (*ShowRetentionPoliciesStatement, error) {
stmt := &ShowRetentionPoliciesStatement{}
// Expect an "ON" keyword.
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == ON {
// Parse the database.
ident, err := p.ParseIdent()
if err != nil {
return nil, err
... | go | func (p *Parser) parseShowRetentionPoliciesStatement() (*ShowRetentionPoliciesStatement, error) {
stmt := &ShowRetentionPoliciesStatement{}
// Expect an "ON" keyword.
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == ON {
// Parse the database.
ident, err := p.ParseIdent()
if err != nil {
return nil, err
... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseShowRetentionPoliciesStatement",
"(",
")",
"(",
"*",
"ShowRetentionPoliciesStatement",
",",
"error",
")",
"{",
"stmt",
":=",
"&",
"ShowRetentionPoliciesStatement",
"{",
"}",
"\n\n",
"// Expect an \"ON\" keyword.",
"if",
"t... | // parseShowRetentionPoliciesStatement parses a string and returns a ShowRetentionPoliciesStatement.
// This function assumes the "SHOW RETENTION POLICIES" tokens have been consumed. | [
"parseShowRetentionPoliciesStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"ShowRetentionPoliciesStatement",
".",
"This",
"function",
"assumes",
"the",
"SHOW",
"RETENTION",
"POLICIES",
"tokens",
"have",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L1127-L1143 |
133,099 | influxdata/influxql | parser.go | parseShowTagKeysStatement | func (p *Parser) parseShowTagKeysStatement() (*ShowTagKeysStatement, error) {
stmt := &ShowTagKeysStatement{}
var err error
// Parse optional ON clause.
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == ON {
// Parse the database.
stmt.Database, err = p.ParseIdent()
if err != nil {
return nil, err
}
} e... | go | func (p *Parser) parseShowTagKeysStatement() (*ShowTagKeysStatement, error) {
stmt := &ShowTagKeysStatement{}
var err error
// Parse optional ON clause.
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == ON {
// Parse the database.
stmt.Database, err = p.ParseIdent()
if err != nil {
return nil, err
}
} e... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseShowTagKeysStatement",
"(",
")",
"(",
"*",
"ShowTagKeysStatement",
",",
"error",
")",
"{",
"stmt",
":=",
"&",
"ShowTagKeysStatement",
"{",
"}",
"\n",
"var",
"err",
"error",
"\n\n",
"// Parse optional ON clause.",
"if... | // parseShowTagKeysStatement parses a string and returns a Statement.
// This function assumes the "SHOW TAG KEYS" tokens have already been consumed. | [
"parseShowTagKeysStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"Statement",
".",
"This",
"function",
"assumes",
"the",
"SHOW",
"TAG",
"KEYS",
"tokens",
"have",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L1204-L1259 |
Subsets and Splits
SQL Console for google/code_x_glue_ct_code_to_text
This query implements a thoughtful three-tier curation strategy to build a balanced safety dataset, categorizing code by destructive operations, safe I/O operations, and pure computational negatives with subsampling—revealing important patterns about how destructive intent manifests in Python code for model safety research.
SQL Console for google/code_x_glue_ct_code_to_text
This query performs meaningful classification of Python code samples into safety-relevant tiers based on destructive operations, I/O patterns, and pure computation, which could be valuable for building safety classifiers or curating training data, though the output itself is a filtered/ranked dataset rather than revealing novel statistical insights.