MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / extract_single_value

Function extract_single_value

src/sql/src/session/vars/value.rs:98–107  ·  view source on GitHub ↗

Helper method to extract a single value from any kind of [`VarInput`].

(input: VarInput<'_>)

Source from the content-addressed store, hash-verified

96
97/// Helper method to extract a single value from any kind of [`VarInput`].
98fn extract_single_value(input: VarInput<'_>) -> Result<&str, VarParseError> {
99 match input {
100 VarInput::Flat(value) => Ok(value),
101 VarInput::SqlSet([value]) => Ok(value),
102 VarInput::SqlSet(values) => Err(VarParseError::InvalidParameterValue {
103 invalid_values: values.to_vec(),
104 reason: "expects a single value".into(),
105 }),
106 }
107}
108
109impl<V: Value + Clone> Value for Option<V> {
110 fn type_name() -> Cow<'static, str>

Callers 1

parseMethod · 0.85

Calls 1

to_vecMethod · 0.80

Tested by

no test coverage detected