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

Function seed_data

libs/@local/hashql/eval/tests/orchestrator/seed.rs:277–383  ·  view source on GitHub ↗
(
    store: &mut PostgresStore<Client>,
)

Source from the content-addressed store, hash-verified

275}
276
277async fn seed_data(
278 store: &mut PostgresStore<Client>,
279) -> Result<SeededEntities, Report<SetupError>> {
280 let system_account_id: MachineId = store
281 .get_or_create_system_machine("h")
282 .await
283 .change_context(SetupError::Seed)
284 .attach("could not create system machine")?;
285 let user_id = store
286 .create_user_actor(
287 system_account_id.into(),
288 CreateUserActorParams {
289 user_id: None,
290 shortname: Some("orchestrator-test".to_owned()),
291 registration_complete: true,
292 },
293 )
294 .await
295 .change_context(SetupError::Seed)
296 .attach("could not create test user")?
297 .user_id;
298
299 let actor_id: ActorEntityUuid = user_id.into();
300 let web_id: WebId = user_id.into();
301 let ownership = OntologyOwnership::Local { web_id };
302
303 seed_ontology(store, actor_id, &ownership).await?;
304
305 let alice = create_entity(
306 store,
307 actor_id,
308 web_id,
309 entity_type::PERSON_V1,
310 entity::PERSON_ALICE_V1,
311 false,
312 )
313 .await?;
314
315 let bob = create_entity(
316 store,
317 actor_id,
318 web_id,
319 entity_type::PERSON_V1,
320 entity::PERSON_BOB_V1,
321 false,
322 )
323 .await?;
324
325 let organization = create_entity(
326 store,
327 actor_id,
328 web_id,
329 entity_type::ORGANIZATION_V1,
330 entity::ORGANIZATION_V1,
331 false,
332 )
333 .await?;
334

Callers 1

setupFunction · 0.85

Calls 15

seed_ontologyFunction · 0.85
entity_type_idFunction · 0.85
OkInterface · 0.85
create_entityMethod · 0.80
create_entityFunction · 0.70
entity_provenanceFunction · 0.70
fromFunction · 0.50
emptyFunction · 0.50
defaultFunction · 0.50
attachMethod · 0.45
change_contextMethod · 0.45

Tested by

no test coverage detected