MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / ParseExprWithInt

Function ParseExprWithInt

pkg/sql/parser/parse.go:392–401  ·  view source on GitHub ↗

ParseExprWithInt parses a SQL scalar expression, using the given type when INT is used as type name in the SQL syntax. The caller is responsible for ensuring that the input is, in fact, a valid SQL scalar expression — the results are undefined if the string contains invalid SQL syntax.

(sql string, nakedIntType *types.T)

Source from the content-addressed store, hash-verified

390// scalar expression — the results are undefined if the string
391// contains invalid SQL syntax.
392func ParseExprWithInt(sql string, nakedIntType *types.T) (tree.Expr, error) {
393 exprs, err := parseExprsWithInt([]string{sql}, nakedIntType)
394 if err != nil {
395 return nil, err
396 }
397 if len(exprs) != 1 {
398 return nil, errors.AssertionFailedf("expected 1 expression, found %d", len(exprs))
399 }
400 return exprs[0], nil
401}
402
403// GetTypeReferenceFromName turns a type name into a type
404// reference. This supports only “simple” (single-identifier)

Callers 1

ParseExprFunction · 0.85

Calls 1

parseExprsWithIntFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…