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 list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
11,000 | 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 |
11,001 | 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 |
11,002 | 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 |
11,003 | 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 |
11,004 | 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 |
11,005 | 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 |
11,006 | 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 |
11,007 | 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 |
11,008 | 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 |
11,009 | 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 |
11,010 | 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 |
11,011 | 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 |
11,012 | 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 |
11,013 | 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 |
11,014 | 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 |
11,015 | 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 |
11,016 | 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 |
11,017 | 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 |
11,018 | 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 |
11,019 | 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 |
11,020 | 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 |
11,021 | 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 |
11,022 | 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 |
11,023 | 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 |
11,024 | 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 |
11,025 | 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 |
11,026 | 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 |
11,027 | 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 |
11,028 | 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 |
11,029 | 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 |
11,030 | 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 |
11,031 | 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 |
11,032 | 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 |
11,033 | 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 |
11,034 | 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 |
11,035 | 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 |
11,036 | 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 |
11,037 | 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 |
11,038 | 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 |
11,039 | 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 |
11,040 | 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 |
11,041 | 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 |
11,042 | 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 |
11,043 | 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 |
11,044 | 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 |
11,045 | 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 |
11,046 | 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 |
11,047 | 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 |
11,048 | 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 |
11,049 | 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 |
11,050 | 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 |
11,051 | 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 |
11,052 | 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 |
11,053 | 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 |
11,054 | 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 |
11,055 | 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 |
11,056 | 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 |
11,057 | 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 |
11,058 | 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 |
11,059 | 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 |
11,060 | 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 |
11,061 | 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 |
11,062 | 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 |
11,063 | 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 |
11,064 | 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 |
11,065 | 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 |
11,066 | 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 |
11,067 | 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 |
11,068 | 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 |
11,069 | 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 |
11,070 | 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 |
11,071 | 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 |
11,072 | 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 |
11,073 | 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 |
11,074 | 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 |
11,075 | 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 |
11,076 | 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 |
11,077 | 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 |
11,078 | 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 |
11,079 | 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 |
11,080 | 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 |
11,081 | 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 |
11,082 | 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 |
11,083 | 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 |
11,084 | influxdata/influxql | parser.go | parseShowTagValuesStatement | func (p *Parser) parseShowTagValuesStatement() (Statement, error) {
stmt := &ShowTagValuesStatement{}
var err error
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == EXACT {
return p.parseShowTagValuesCardinalityStatement(true)
} else if tok == CARDINALITY {
return p.parseShowTagValuesCardinalityStatement(false... | go | func (p *Parser) parseShowTagValuesStatement() (Statement, error) {
stmt := &ShowTagValuesStatement{}
var err error
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == EXACT {
return p.parseShowTagValuesCardinalityStatement(true)
} else if tok == CARDINALITY {
return p.parseShowTagValuesCardinalityStatement(false... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseShowTagValuesStatement",
"(",
")",
"(",
"Statement",
",",
"error",
")",
"{",
"stmt",
":=",
"&",
"ShowTagValuesStatement",
"{",
"}",
"\n",
"var",
"err",
"error",
"\n\n",
"if",
"tok",
",",
"_",
",",
"_",
":=",
... | // parseShowTagValuesStatement parses a string and returns a Statement.
// This function assumes the "SHOW TAG VALUES" tokens have already been consumed. | [
"parseShowTagValuesStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"Statement",
".",
"This",
"function",
"assumes",
"the",
"SHOW",
"TAG",
"VALUES",
"tokens",
"have",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L1263-L1320 |
11,085 | influxdata/influxql | parser.go | parseShowTagValuesCardinalityStatement | func (p *Parser) parseShowTagValuesCardinalityStatement(exact bool) (Statement, error) {
var err error
stmt := &ShowTagValuesCardinalityStatement{Exact: exact}
if stmt.Exact {
// Parse remaining CARDINALITY token
if tok, pos, lit := p.ScanIgnoreWhitespace(); tok != CARDINALITY {
return nil, newParseError(tok... | go | func (p *Parser) parseShowTagValuesCardinalityStatement(exact bool) (Statement, error) {
var err error
stmt := &ShowTagValuesCardinalityStatement{Exact: exact}
if stmt.Exact {
// Parse remaining CARDINALITY token
if tok, pos, lit := p.ScanIgnoreWhitespace(); tok != CARDINALITY {
return nil, newParseError(tok... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseShowTagValuesCardinalityStatement",
"(",
"exact",
"bool",
")",
"(",
"Statement",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n",
"stmt",
":=",
"&",
"ShowTagValuesCardinalityStatement",
"{",
"Exact",
":",
"exact"... | // This function assumes the "SHOW TAG VALUES" tokens have already been consumed. | [
"This",
"function",
"assumes",
"the",
"SHOW",
"TAG",
"VALUES",
"tokens",
"have",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L1323-L1375 |
11,086 | influxdata/influxql | parser.go | parseTagKeyExpr | func (p *Parser) parseTagKeyExpr() (Token, Literal, error) {
var err error
// Parse required WITH KEY tokens.
if err := p.parseTokens([]Token{WITH, KEY}); err != nil {
return 0, nil, err
}
// Parse required IN, EQ, or EQREGEX token.
tok, pos, lit := p.ScanIgnoreWhitespace()
if tok == IN {
// Parse required... | go | func (p *Parser) parseTagKeyExpr() (Token, Literal, error) {
var err error
// Parse required WITH KEY tokens.
if err := p.parseTokens([]Token{WITH, KEY}); err != nil {
return 0, nil, err
}
// Parse required IN, EQ, or EQREGEX token.
tok, pos, lit := p.ScanIgnoreWhitespace()
if tok == IN {
// Parse required... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseTagKeyExpr",
"(",
")",
"(",
"Token",
",",
"Literal",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n\n",
"// Parse required WITH KEY tokens.",
"if",
"err",
":=",
"p",
".",
"parseTokens",
"(",
"[",
"]",
"Toke... | // parseTagKeys parses a string and returns a list of tag keys. | [
"parseTagKeys",
"parses",
"a",
"string",
"and",
"returns",
"a",
"list",
"of",
"tag",
"keys",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L1378-L1424 |
11,087 | influxdata/influxql | parser.go | parseShowFieldKeyCardinalityStatement | func (p *Parser) parseShowFieldKeyCardinalityStatement() (Statement, error) {
var err error
var exactCardinality bool
requiredTokens := []string{"EXACT", "CARDINALITY"}
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == EXACT {
exactCardinality = true
requiredTokens = requiredTokens[1:]
} else {
p.Unscan()
}
... | go | func (p *Parser) parseShowFieldKeyCardinalityStatement() (Statement, error) {
var err error
var exactCardinality bool
requiredTokens := []string{"EXACT", "CARDINALITY"}
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == EXACT {
exactCardinality = true
requiredTokens = requiredTokens[1:]
} else {
p.Unscan()
}
... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseShowFieldKeyCardinalityStatement",
"(",
")",
"(",
"Statement",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n",
"var",
"exactCardinality",
"bool",
"\n",
"requiredTokens",
":=",
"[",
"]",
"string",
"{",
"\"",
... | // This function assumes the "SHOW FIELD KEY" tokens have already been consumed. | [
"This",
"function",
"assumes",
"the",
"SHOW",
"FIELD",
"KEY",
"tokens",
"have",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L1440-L1494 |
11,088 | influxdata/influxql | parser.go | parseShowFieldKeysStatement | func (p *Parser) parseShowFieldKeysStatement() (*ShowFieldKeysStatement, error) {
stmt := &ShowFieldKeysStatement{}
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
... | go | func (p *Parser) parseShowFieldKeysStatement() (*ShowFieldKeysStatement, error) {
stmt := &ShowFieldKeysStatement{}
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
... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseShowFieldKeysStatement",
"(",
")",
"(",
"*",
"ShowFieldKeysStatement",
",",
"error",
")",
"{",
"stmt",
":=",
"&",
"ShowFieldKeysStatement",
"{",
"}",
"\n",
"var",
"err",
"error",
"\n\n",
"// Parse optional ON clause.",... | // parseShowFieldKeysStatement parses a string and returns a Statement.
// This function assumes the "SHOW FIELD KEYS" tokens have already been consumed. | [
"parseShowFieldKeysStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"Statement",
".",
"This",
"function",
"assumes",
"the",
"SHOW",
"FIELD",
"KEYS",
"tokens",
"have",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L1498-L1538 |
11,089 | influxdata/influxql | parser.go | parseDropMeasurementStatement | func (p *Parser) parseDropMeasurementStatement() (*DropMeasurementStatement, error) {
stmt := &DropMeasurementStatement{}
// Parse the name of the measurement to be dropped.
lit, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = lit
return stmt, nil
} | go | func (p *Parser) parseDropMeasurementStatement() (*DropMeasurementStatement, error) {
stmt := &DropMeasurementStatement{}
// Parse the name of the measurement to be dropped.
lit, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = lit
return stmt, nil
} | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseDropMeasurementStatement",
"(",
")",
"(",
"*",
"DropMeasurementStatement",
",",
"error",
")",
"{",
"stmt",
":=",
"&",
"DropMeasurementStatement",
"{",
"}",
"\n\n",
"// Parse the name of the measurement to be dropped.",
"lit"... | // parseDropMeasurementStatement parses a string and returns a DropMeasurementStatement.
// This function assumes the "DROP MEASUREMENT" tokens have already been consumed. | [
"parseDropMeasurementStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"DropMeasurementStatement",
".",
"This",
"function",
"assumes",
"the",
"DROP",
"MEASUREMENT",
"tokens",
"have",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L1542-L1553 |
11,090 | influxdata/influxql | parser.go | parseDropShardStatement | func (p *Parser) parseDropShardStatement() (*DropShardStatement, error) {
var err error
stmt := &DropShardStatement{}
// Parse the ID of the shard to be dropped.
if stmt.ID, err = p.ParseUInt64(); err != nil {
return nil, err
}
return stmt, nil
} | go | func (p *Parser) parseDropShardStatement() (*DropShardStatement, error) {
var err error
stmt := &DropShardStatement{}
// Parse the ID of the shard to be dropped.
if stmt.ID, err = p.ParseUInt64(); err != nil {
return nil, err
}
return stmt, nil
} | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseDropShardStatement",
"(",
")",
"(",
"*",
"DropShardStatement",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n",
"stmt",
":=",
"&",
"DropShardStatement",
"{",
"}",
"\n\n",
"// Parse the ID of the shard to be dropped... | // parseDropShardStatement parses a string and returns a
// DropShardStatement. This function assumes the "DROP SHARD" tokens
// have already been consumed. | [
"parseDropShardStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"DropShardStatement",
".",
"This",
"function",
"assumes",
"the",
"DROP",
"SHARD",
"tokens",
"have",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L1606-L1615 |
11,091 | influxdata/influxql | parser.go | parseGrantsForUserStatement | func (p *Parser) parseGrantsForUserStatement() (*ShowGrantsForUserStatement, error) {
stmt := &ShowGrantsForUserStatement{}
// Parse the name of the user to be displayed.
lit, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = lit
return stmt, nil
} | go | func (p *Parser) parseGrantsForUserStatement() (*ShowGrantsForUserStatement, error) {
stmt := &ShowGrantsForUserStatement{}
// Parse the name of the user to be displayed.
lit, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = lit
return stmt, nil
} | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseGrantsForUserStatement",
"(",
")",
"(",
"*",
"ShowGrantsForUserStatement",
",",
"error",
")",
"{",
"stmt",
":=",
"&",
"ShowGrantsForUserStatement",
"{",
"}",
"\n\n",
"// Parse the name of the user to be displayed.",
"lit",
... | // parseGrantsForUserStatement parses a string and returns a ShowGrantsForUserStatement.
// This function assumes the "SHOW GRANTS" tokens have already been consumed. | [
"parseGrantsForUserStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"ShowGrantsForUserStatement",
".",
"This",
"function",
"assumes",
"the",
"SHOW",
"GRANTS",
"tokens",
"have",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L1625-L1636 |
11,092 | influxdata/influxql | parser.go | parseCreateContinuousQueryStatement | func (p *Parser) parseCreateContinuousQueryStatement() (*CreateContinuousQueryStatement, error) {
stmt := &CreateContinuousQueryStatement{}
// Read the id of the query to create.
ident, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = ident
// Expect an "ON" keyword.
if tok, pos, lit := p... | go | func (p *Parser) parseCreateContinuousQueryStatement() (*CreateContinuousQueryStatement, error) {
stmt := &CreateContinuousQueryStatement{}
// Read the id of the query to create.
ident, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = ident
// Expect an "ON" keyword.
if tok, pos, lit := p... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseCreateContinuousQueryStatement",
"(",
")",
"(",
"*",
"CreateContinuousQueryStatement",
",",
"error",
")",
"{",
"stmt",
":=",
"&",
"CreateContinuousQueryStatement",
"{",
"}",
"\n\n",
"// Read the id of the query to create.",
... | // parseCreateContinuousQueriesStatement parses a string and returns a CreateContinuousQueryStatement.
// This function assumes the "CREATE CONTINUOUS" tokens have already been consumed. | [
"parseCreateContinuousQueriesStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"CreateContinuousQueryStatement",
".",
"This",
"function",
"assumes",
"the",
"CREATE",
"CONTINUOUS",
"tokens",
"have",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L1646-L1714 |
11,093 | influxdata/influxql | parser.go | parseCreateDatabaseStatement | func (p *Parser) parseCreateDatabaseStatement() (*CreateDatabaseStatement, error) {
stmt := &CreateDatabaseStatement{}
// Parse the name of the database to be created.
lit, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = lit
// Look for "WITH"
if tok, _, _ := p.ScanIgnoreWhitespace(); to... | go | func (p *Parser) parseCreateDatabaseStatement() (*CreateDatabaseStatement, error) {
stmt := &CreateDatabaseStatement{}
// Parse the name of the database to be created.
lit, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = lit
// Look for "WITH"
if tok, _, _ := p.ScanIgnoreWhitespace(); to... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseCreateDatabaseStatement",
"(",
")",
"(",
"*",
"CreateDatabaseStatement",
",",
"error",
")",
"{",
"stmt",
":=",
"&",
"CreateDatabaseStatement",
"{",
"}",
"\n\n",
"// Parse the name of the database to be created.",
"lit",
",... | // parseCreateDatabaseStatement parses a string and returns a CreateDatabaseStatement.
// This function assumes the "CREATE DATABASE" tokens have already been consumed. | [
"parseCreateDatabaseStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"CreateDatabaseStatement",
".",
"This",
"function",
"assumes",
"the",
"CREATE",
"DATABASE",
"tokens",
"have",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L1718-L1791 |
11,094 | influxdata/influxql | parser.go | parseDropDatabaseStatement | func (p *Parser) parseDropDatabaseStatement() (*DropDatabaseStatement, error) {
stmt := &DropDatabaseStatement{}
// Parse the name of the database to be dropped.
lit, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = lit
return stmt, nil
} | go | func (p *Parser) parseDropDatabaseStatement() (*DropDatabaseStatement, error) {
stmt := &DropDatabaseStatement{}
// Parse the name of the database to be dropped.
lit, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = lit
return stmt, nil
} | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseDropDatabaseStatement",
"(",
")",
"(",
"*",
"DropDatabaseStatement",
",",
"error",
")",
"{",
"stmt",
":=",
"&",
"DropDatabaseStatement",
"{",
"}",
"\n\n",
"// Parse the name of the database to be dropped.",
"lit",
",",
"... | // parseDropDatabaseStatement parses a string and returns a DropDatabaseStatement.
// This function assumes the DROP DATABASE tokens have already been consumed. | [
"parseDropDatabaseStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"DropDatabaseStatement",
".",
"This",
"function",
"assumes",
"the",
"DROP",
"DATABASE",
"tokens",
"have",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L1795-L1806 |
11,095 | influxdata/influxql | parser.go | parseDropSubscriptionStatement | func (p *Parser) parseDropSubscriptionStatement() (*DropSubscriptionStatement, error) {
stmt := &DropSubscriptionStatement{}
// Read the id of the subscription to drop.
ident, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = ident
// Expect an "ON" keyword.
if tok, pos, lit := p.ScanIgnor... | go | func (p *Parser) parseDropSubscriptionStatement() (*DropSubscriptionStatement, error) {
stmt := &DropSubscriptionStatement{}
// Read the id of the subscription to drop.
ident, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = ident
// Expect an "ON" keyword.
if tok, pos, lit := p.ScanIgnor... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseDropSubscriptionStatement",
"(",
")",
"(",
"*",
"DropSubscriptionStatement",
",",
"error",
")",
"{",
"stmt",
":=",
"&",
"DropSubscriptionStatement",
"{",
"}",
"\n\n",
"// Read the id of the subscription to drop.",
"ident",
... | // parseDropSubscriptionStatement parses a string and returns a DropSubscriptionStatement.
// This function assumes the "DROP SUBSCRIPTION" tokens have already been consumed. | [
"parseDropSubscriptionStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"DropSubscriptionStatement",
".",
"This",
"function",
"assumes",
"the",
"DROP",
"SUBSCRIPTION",
"tokens",
"have",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L1810-L1842 |
11,096 | influxdata/influxql | parser.go | parseCreateUserStatement | func (p *Parser) parseCreateUserStatement() (*CreateUserStatement, error) {
stmt := &CreateUserStatement{}
// Parse name of the user to be created.
ident, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = ident
// Consume "WITH PASSWORD" tokens
if err := p.parseTokens([]Token{WITH, PASSWOR... | go | func (p *Parser) parseCreateUserStatement() (*CreateUserStatement, error) {
stmt := &CreateUserStatement{}
// Parse name of the user to be created.
ident, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = ident
// Consume "WITH PASSWORD" tokens
if err := p.parseTokens([]Token{WITH, PASSWOR... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseCreateUserStatement",
"(",
")",
"(",
"*",
"CreateUserStatement",
",",
"error",
")",
"{",
"stmt",
":=",
"&",
"CreateUserStatement",
"{",
"}",
"\n\n",
"// Parse name of the user to be created.",
"ident",
",",
"err",
":="... | // parseCreateUserStatement parses a string and returns a CreateUserStatement.
// This function assumes the "CREATE USER" tokens have already been consumed. | [
"parseCreateUserStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"CreateUserStatement",
".",
"This",
"function",
"assumes",
"the",
"CREATE",
"USER",
"tokens",
"have",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L1871-L1906 |
11,097 | influxdata/influxql | parser.go | parseDropUserStatement | func (p *Parser) parseDropUserStatement() (*DropUserStatement, error) {
stmt := &DropUserStatement{}
// Parse the name of the user to be dropped.
lit, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = lit
return stmt, nil
} | go | func (p *Parser) parseDropUserStatement() (*DropUserStatement, error) {
stmt := &DropUserStatement{}
// Parse the name of the user to be dropped.
lit, err := p.ParseIdent()
if err != nil {
return nil, err
}
stmt.Name = lit
return stmt, nil
} | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseDropUserStatement",
"(",
")",
"(",
"*",
"DropUserStatement",
",",
"error",
")",
"{",
"stmt",
":=",
"&",
"DropUserStatement",
"{",
"}",
"\n\n",
"// Parse the name of the user to be dropped.",
"lit",
",",
"err",
":=",
... | // parseDropUserStatement parses a string and returns a DropUserStatement.
// This function assumes the DROP USER tokens have already been consumed. | [
"parseDropUserStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"DropUserStatement",
".",
"This",
"function",
"assumes",
"the",
"DROP",
"USER",
"tokens",
"have",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L1910-L1921 |
11,098 | influxdata/influxql | parser.go | parseExplainStatement | func (p *Parser) parseExplainStatement() (*ExplainStatement, error) {
stmt := &ExplainStatement{}
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == ANALYZE {
stmt.Analyze = true
} else {
p.Unscan()
}
if tok, pos, lit := p.ScanIgnoreWhitespace(); tok != SELECT {
return nil, newParseError(tokstr(tok, lit), []... | go | func (p *Parser) parseExplainStatement() (*ExplainStatement, error) {
stmt := &ExplainStatement{}
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == ANALYZE {
stmt.Analyze = true
} else {
p.Unscan()
}
if tok, pos, lit := p.ScanIgnoreWhitespace(); tok != SELECT {
return nil, newParseError(tokstr(tok, lit), []... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseExplainStatement",
"(",
")",
"(",
"*",
"ExplainStatement",
",",
"error",
")",
"{",
"stmt",
":=",
"&",
"ExplainStatement",
"{",
"}",
"\n\n",
"if",
"tok",
",",
"_",
",",
"_",
":=",
"p",
".",
"ScanIgnoreWhitespa... | // parseExplainStatement parses a string and return an ExplainStatement.
// This function assumes the EXPLAIN token has already been consumed. | [
"parseExplainStatement",
"parses",
"a",
"string",
"and",
"return",
"an",
"ExplainStatement",
".",
"This",
"function",
"assumes",
"the",
"EXPLAIN",
"token",
"has",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L1925-L1944 |
11,099 | influxdata/influxql | parser.go | parseShowStatsStatement | func (p *Parser) parseShowStatsStatement() (*ShowStatsStatement, error) {
stmt := &ShowStatsStatement{}
var err error
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == FOR {
stmt.Module, err = p.parseString()
} else {
p.Unscan()
}
return stmt, err
} | go | func (p *Parser) parseShowStatsStatement() (*ShowStatsStatement, error) {
stmt := &ShowStatsStatement{}
var err error
if tok, _, _ := p.ScanIgnoreWhitespace(); tok == FOR {
stmt.Module, err = p.parseString()
} else {
p.Unscan()
}
return stmt, err
} | [
"func",
"(",
"p",
"*",
"Parser",
")",
"parseShowStatsStatement",
"(",
")",
"(",
"*",
"ShowStatsStatement",
",",
"error",
")",
"{",
"stmt",
":=",
"&",
"ShowStatsStatement",
"{",
"}",
"\n",
"var",
"err",
"error",
"\n\n",
"if",
"tok",
",",
"_",
",",
"_",
... | // parseShowStatsStatement parses a string and returns a ShowStatsStatement.
// This function assumes the "SHOW STATS" tokens have already been consumed. | [
"parseShowStatsStatement",
"parses",
"a",
"string",
"and",
"returns",
"a",
"ShowStatsStatement",
".",
"This",
"function",
"assumes",
"the",
"SHOW",
"STATS",
"tokens",
"have",
"already",
"been",
"consumed",
"."
] | 1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513 | https://github.com/influxdata/influxql/blob/1cbfca8e56b6eaa120f5b5161e4f0d5edcc9e513/parser.go#L1960-L1971 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.