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

Method get

src/sql/src/session/vars.rs:541–559  ·  view source on GitHub ↗

Returns a [`Var`] representing the configuration parameter with the specified name. Configuration parameters are matched case insensitively. If no such configuration parameter exists, `get` returns an error. Note that if `name` is known at compile time, you should instead use the named accessor to access the variable with its true Rust type. For example, `self.get("sql_safe_updates").value()` re

(&self, system_vars: &SystemVars, name: &str)

Source from the content-addressed store, hash-verified

539 /// example, `self.get("sql_safe_updates").value()` returns the string
540 /// `"true"` or `"false"`, while `self.sql_safe_updates()` returns a bool.
541 pub fn get(&self, system_vars: &SystemVars, name: &str) -> Result<&dyn Var, VarError> {
542 let name = compat_translate_name(name);
543
544 let name = UncasedStr::new(name);
545 if name == MZ_VERSION_NAME {
546 Ok(&self.mz_version)
547 } else if name == IS_SUPERUSER_NAME {
548 Ok(&self.user)
549 } else {
550 self.vars
551 .get(name)
552 .map(|v| {
553 v.visible(&self.user, system_vars)?;
554 Ok(v.as_var())
555 })
556 .transpose()?
557 .ok_or_else(|| VarError::UnknownParameter(name.to_string()))
558 }
559 }
560
561 /// Returns a [`SessionVar`] for inspection.
562 ///

Callers 15

purify_create_sinkFunction · 0.45
purify_create_sourceFunction · 0.45
indexMethod · 0.45
resolve_opFunction · 0.45
visit_item_name_mutMethod · 0.45
expect_valueMethod · 0.45
inspectMethod · 0.45

Calls 5

compat_translate_nameFunction · 0.85
as_varMethod · 0.80
mapMethod · 0.45
visibleMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected