Skip to content

Commit

Permalink
增加动态更新sql语句
Browse files Browse the repository at this point in the history
  • Loading branch information
EndeavorEcho committed Feb 18, 2022
1 parent 07ccaa8 commit 4bb1ddd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ func (e *Engine) Valid(json string) bool {

}

func (e *Engine) Update(query string) error {
lex := parser.NewLex(query)
statements := parser.Parse(lex)
if lex.ErrorInfo != nil {
return lex.ErrorInfo
}
e.statement = statements
e.selectStatement = parser.Info(statements[0])
return nil
}

func (e *Engine) valid(json *gjson.Result) bool {
return Valid(e.selectStatement.WhereCondition.Left, e.selectStatement.WhereCondition.Right, e.selectStatement.WhereCondition.Op, json)
}
Expand Down

0 comments on commit 4bb1ddd

Please sign in to comment.