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

Method seed

tests/graph/integration/postgres/lib.rs:206–316  ·  view source on GitHub ↗
(
        &mut self,
        data_types: D,
        property_types: P,
        entity_types: E,
    )

Source from the content-addressed store, hash-verified

204
205impl DatabaseTestWrapper {
206 pub async fn seed<D, P, E>(
207 &mut self,
208 data_types: D,
209 property_types: P,
210 entity_types: E,
211 ) -> Result<DatabaseApi<'_>, Report<InsertionError>>
212 where
213 D: IntoIterator<Item = &'static str, IntoIter: Send> + Send,
214 P: IntoIterator<Item = &'static str, IntoIter: Send> + Send,
215 E: IntoIterator<Item = &'static str, IntoIter: Send> + Send,
216 {
217 let mut store = self
218 .connection
219 .transaction()
220 .await
221 .expect("could not start test transaction");
222
223 store
224 .seed_system_policies()
225 .await
226 .expect("Should be able to seed system policies");
227
228 let system_account_id = store
229 .get_or_create_system_machine("h")
230 .await
231 .change_context(InsertionError)?;
232 let user_id = store
233 .create_user_actor(
234 system_account_id.into(),
235 CreateUserActorParams {
236 user_id: None,
237 shortname: Some("bench-user".to_owned()),
238 registration_complete: true,
239 },
240 )
241 .await
242 .change_context(InsertionError)?
243 .user_id;
244
245 store
246 .create_data_types(
247 user_id.into(),
248 data_types.into_iter().map(|data_type_str| {
249 let schema: DataType = serde_json::from_str(data_type_str)
250 .expect("could not parse data type representation");
251 CreateDataTypeParams {
252 schema,
253 ownership: OntologyOwnership::Local {
254 web_id: user_id.into(),
255 },
256 conflict_behavior: ConflictBehavior::Skip,
257 provenance: ProvidedOntologyEditionProvenance {
258 actor_type: ActorType::User,
259 origin: OriginProvenance::from_empty_type(OriginType::Api),
260 sources: Vec::new(),
261 },
262 conversions: HashMap::new(),
263 }

Callers 15

seed-crm-data.tsFile · 0.45
insertFunction · 0.45
seedFunction · 0.45
seedFunction · 0.45
insertFunction · 0.45
queryFunction · 0.45
updateFunction · 0.45
seedFunction · 0.45
insertFunction · 0.45
get_entity_linksFunction · 0.45
remove_linkFunction · 0.45

Calls 13

OkInterface · 0.85
expectMethod · 0.45
transactionMethod · 0.45
seed_system_policiesMethod · 0.45
change_contextMethod · 0.45
create_user_actorMethod · 0.45
to_ownedMethod · 0.45
create_data_typesMethod · 0.45
mapMethod · 0.45
into_iterMethod · 0.45
create_property_typesMethod · 0.45

Tested by

no test coverage detected