Validate checks whether the given SQL string is syntactically valid without building a full AST. It tokenizes the input and runs the parser, but the returned AST is immediately released. This is significantly faster than Parse() when you only need to know if the SQL is valid.
(sql string)
| 32 | // returned AST is immediately released. This is significantly faster than |
| 33 | // Parse() when you only need to know if the SQL is valid. |
| 34 | func Validate(sql string) error { |
| 35 | return ValidateBytes([]byte(sql)) |
| 36 | } |
| 37 | |
| 38 | // ValidateBytes is like Validate but accepts []byte to avoid a string copy. |
| 39 | func ValidateBytes(input []byte) error { |