MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / validateN1QLQuery

Function validateN1QLQuery

db/functions/n1ql_function.go:44–50  ·  view source on GitHub ↗
(query string)

Source from the content-addressed store, hash-verified

42var n1qlQueryRegex = regexp.MustCompile(`^\s*\(*(?i:SELECT)\b`)
43
44func validateN1QLQuery(query string) error {
45 if n1qlQueryRegex.MatchString(query) {
46 return nil
47 } else {
48 return fmt.Errorf("only SELECT queries are allowed")
49 }
50}
51
52func (fn *n1qlInvocation) Iterate() (sgbucket.QueryResultIterator, error) {
53 var userArg n1qlUserArgument

Callers 1

compileFunctionFunction · 0.85

Calls 1

ErrorfMethod · 0.80

Tested by

no test coverage detected