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

Method insert

src/expr-test-util/src/lib.rs:110–127  ·  view source on GitHub ↗

Registers an object in the catalog. Specifying `transient` as true allows the object to be deleted by [Self::remove_transient_objects]. Returns the GlobalId assigned by the catalog to the object. Errors if an object of the same name is already in the catalog.

(
        &mut self,
        name: &str,
        typ: SqlRelationType,
        transient: bool,
    )

Source from the content-addressed store, hash-verified

108 ///
109 /// Errors if an object of the same name is already in the catalog.
110 pub fn insert(
111 &mut self,
112 name: &str,
113 typ: SqlRelationType,
114 transient: bool,
115 ) -> Result<GlobalId, String> {
116 if self.objects.contains_key(name) {
117 return Err(format!("Object {} already exists in catalog", name));
118 }
119 let id = if transient {
120 GlobalId::Transient(u64::cast_from(self.objects.len()))
121 } else {
122 GlobalId::User(u64::cast_from(self.objects.len()))
123 };
124 self.objects.insert(name.to_string(), (id, typ));
125 self.names.insert(id, name.to_string());
126 Ok(id)
127 }
128
129 fn get(&'a self, name: &str) -> Option<&'a (GlobalId, SqlRelationType)> {
130 self.objects.get(name)

Callers 15

handle_test_commandMethod · 0.45
build_letMethod · 0.45
setMethod · 0.45
bindMethod · 0.45
serveMethod · 0.45
handle_loginFunction · 0.45
http_authFunction · 0.45
ensure_session_unexpiredFunction · 0.45
with_oidc_authMethod · 0.45

Calls 6

contains_keyMethod · 0.80
UserClass · 0.50
lenMethod · 0.45
to_stringMethod · 0.45
getMethod · 0.45
setMethod · 0.45