Skip to content

Commit

Permalink
*: add comment and fix lint tool (#7503)
Browse files Browse the repository at this point in the history
  • Loading branch information
winoros authored and lysu committed Aug 27, 2018
1 parent 1d0d0a6 commit 38c939f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions expression/simple_rewriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ func RewriteSimpleExprWithTableInfo(ctx sessionctx.Context, tbl *model.TableInfo
return rewriter.pop(), nil
}

// ParseSimpleExprsWithSchema parses simple expression string to Expression.
// The expression string must only reference the column in the given schema.
func ParseSimpleExprsWithSchema(ctx sessionctx.Context, exprStr string, schema *Schema) ([]Expression, error) {
exprStr = "select " + exprStr
stmts, err := parser.New().Parse(exprStr, "", "")
Expand All @@ -74,6 +76,7 @@ func ParseSimpleExprsWithSchema(ctx sessionctx.Context, exprStr string, schema *
return exprs, nil
}

// RewriteSimpleExprWithSchema rewrites simple ast.ExprNode to expression.Expression.
func RewriteSimpleExprWithSchema(ctx sessionctx.Context, expr ast.ExprNode, schema *Schema) (Expression, error) {
rewriter := &simpleRewriter{ctx: ctx, schema: schema}
expr.Accept(rewriter)
Expand Down
4 changes: 2 additions & 2 deletions revive.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ignoreGeneratedHeader = false
severity = "error"
confidence = 0.8
errorCode = 0
warningCode = 0
errorCode = -1
warningCode = -1

[rule.blank-imports]
[rule.context-as-argument]
Expand Down

0 comments on commit 38c939f

Please sign in to comment.