MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / get_by_name

Method get_by_name

crates/openshell-server/src/persistence/sqlite.rs:321–340  ·  view source on GitHub ↗
(
        &self,
        object_type: &str,
        name: &str,
    )

Source from the content-addressed store, hash-verified

319 }
320
321 pub async fn get_by_name(
322 &self,
323 object_type: &str,
324 name: &str,
325 ) -> PersistenceResult<Option<ObjectRecord>> {
326 let row = sqlx::query(
327 r#"
328SELECT "object_type", "id", "name", "payload", "created_at_ms", "updated_at_ms", "labels", "resource_version"
329FROM "objects"
330WHERE "object_type" = ?1 AND "name" = ?2
331"#,
332 )
333 .bind(object_type)
334 .bind(name)
335 .fetch_optional(&self.pool)
336 .await
337 .map_err(|e| map_db_error(&e))?;
338
339 Ok(row.map(row_to_object_record))
340 }
341
342 pub async fn delete(&self, object_type: &str, id: &str) -> PersistenceResult<bool> {
343 let result = sqlx::query(

Callers 1

put_ifMethod · 0.45

Calls 1

map_db_errorFunction · 0.85

Tested by

no test coverage detected