MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / parse_literal

Function parse_literal

crates/sql-parser/src/parser/mod.rs:331–339  ·  view source on GitHub ↗

Parse a literal expression

(value: Value)

Source from the content-addressed store, hash-verified

329
330/// Parse a literal expression
331pub(crate) fn parse_literal(value: Value) -> SqlParseResult<SqlLiteral> {
332 match value {
333 Value::Boolean(v) => Ok(SqlLiteral::Bool(v)),
334 Value::Number(v, _) => Ok(SqlLiteral::Num(v.into_boxed_str())),
335 Value::SingleQuotedString(s) => Ok(SqlLiteral::Str(s.into_boxed_str())),
336 Value::HexStringLiteral(s) => Ok(SqlLiteral::Hex(s.into_boxed_str())),
337 _ => Err(SqlUnsupported::Literal(value).into()),
338 }
339}
340
341/// Parse an identifier
342pub(crate) fn parse_ident(ObjectName(parts): ObjectName) -> SqlParseResult<SqlIdent> {

Callers 2

parse_exprFunction · 0.85
parse_literal_exprFunction · 0.85

Calls 4

StrFunction · 0.85
OkFunction · 0.50
BoolClass · 0.50
ErrFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…