MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / Validate

Function Validate

pkg/sql/parser/validate.go:34–36  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

32// returned AST is immediately released. This is significantly faster than
33// Parse() when you only need to know if the SQL is valid.
34func Validate(sql string) error {
35 return ValidateBytes([]byte(sql))
36}
37
38// ValidateBytes is like Validate but accepts []byte to avoid a string copy.
39func ValidateBytes(input []byte) error {

Callers 5

TestValidateFunction · 0.92
BenchmarkValidateFunction · 0.92
validateInlineSQLFunction · 0.92

Calls 1

ValidateBytesFunction · 0.85

Tested by 4

TestValidateFunction · 0.74
BenchmarkValidateFunction · 0.74