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

Function insert

tests/graph/integration/postgres/sorting.rs:128–213  ·  view source on GitHub ↗
(database: &mut DatabaseTestWrapper)

Source from the content-addressed store, hash-verified

126}
127
128async fn insert(database: &mut DatabaseTestWrapper) -> DatabaseApi<'_> {
129 let mut api = database
130 .seed(
131 [
132 data_type::VALUE_V1,
133 data_type::TEXT_V1,
134 data_type::NUMBER_V1,
135 ],
136 [
137 property_type::NAME_V1,
138 property_type::AGE_V1,
139 property_type::TEXT_V1,
140 property_type::FAVORITE_SONG_V1,
141 property_type::FAVORITE_FILM_V1,
142 property_type::HOBBY_V1,
143 property_type::INTERESTS_V1,
144 ],
145 [
146 entity_type::PERSON_V1,
147 entity_type::PAGE_V1,
148 entity_type::LINK_V1,
149 entity_type::link::FRIEND_OF_V1,
150 entity_type::link::ACQUAINTANCE_OF_V1,
151 ],
152 )
153 .await
154 .expect("could not seed database");
155
156 let person_entity_type = VersionedUrl {
157 base_url: BaseUrl::new(
158 "https://blockprotocol.org/@alice/types/entity-type/person/".to_owned(),
159 )
160 .expect("couldn't construct Base URL"),
161 version: OntologyTypeVersion {
162 major: 1,
163 pre_release: None,
164 },
165 };
166 let page_entity_type = VersionedUrl {
167 base_url: BaseUrl::new(
168 "https://blockprotocol.org/@alice/types/entity-type/page/".to_owned(),
169 )
170 .expect("couldn't construct Base URL"),
171 version: OntologyTypeVersion {
172 major: 1,
173 pre_release: None,
174 },
175 };
176 let entities_properties = [
177 (entity::PERSON_ALICE_V1, &person_entity_type),
178 (entity::PERSON_BOB_V1, &person_entity_type),
179 (entity::PERSON_CHARLES_V1, &person_entity_type),
180 (entity::PAGE_V1, &page_entity_type),
181 (entity::PAGE_V2, &page_entity_type),
182 ];
183
184 for (idx, (entity, type_id)) in entities_properties.into_iter().enumerate() {
185 let properties: PropertyObject =

Calls 7

create_entityMethod · 0.80
fromFunction · 0.50
expectMethod · 0.45
seedMethod · 0.45
to_ownedMethod · 0.45
into_iterMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected