MCPcopy Create free account
hub / github.com/hashintel/hash / is_actor

Method is_actor

libs/@local/graph/postgres-store/src/permissions/mod.rs:165–183  ·  view source on GitHub ↗

Determines the type of an actor by its ID. # Errors - [`StoreError`] if a database error occurs [`StoreError`]: PrincipalError::StoreError

(
        &self,
        actor_id: impl Into<Uuid>,
    )

Source from the content-addressed store, hash-verified

163 ///
164 /// [`StoreError`]: PrincipalError::StoreError
165 pub async fn is_actor(
166 &self,
167 actor_id: impl Into<Uuid>,
168 ) -> Result<bool, Report<PrincipalError>> {
169 self.as_client()
170 .query_one(
171 "SELECT EXISTS(SELECT 1 FROM actor WHERE id = $1)",
172 &[&actor_id.into()],
173 )
174 .instrument(tracing::info_span!(
175 "SELECT",
176 otel.kind = "client",
177 db.system = "postgresql",
178 peer.service = "Postgres",
179 ))
180 .await
181 .map(|row| row.get(0))
182 .change_context(PrincipalError::StoreError)
183 }
184
185 /// Gets an actor by its ID.
186 ///

Callers 1

assign_role_by_idMethod · 0.80

Calls 4

as_clientMethod · 0.80
getMethod · 0.65
change_contextMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected