Skip to content

Commit 5151b66

Browse files
author
Zoran Cvetkov
committed
cleanup
1 parent d178175 commit 5151b66

File tree

7 files changed

+14
-15
lines changed

7 files changed

+14
-15
lines changed

graph/src/components/store/write.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,30 +1017,29 @@ mod test {
10171017

10181018
let value = value.clone();
10191019
let key = THING_TYPE.parse_key("one").unwrap();
1020-
let vid = 0i64;
10211020
match value {
10221021
Ins(block) => EntityModification::Insert {
10231022
key,
1024-
data: Arc::new(entity! { SCHEMA => id: "one", count: block, vid: vid }),
1023+
data: Arc::new(entity! { SCHEMA => id: "one", count: block }),
10251024
block,
10261025
end: None,
10271026
},
10281027
Ovw(block) => EntityModification::Overwrite {
10291028
key,
1030-
data: Arc::new(entity! { SCHEMA => id: "one", count: block, vid: vid }),
1029+
data: Arc::new(entity! { SCHEMA => id: "one", count: block }),
10311030
block,
10321031
end: None,
10331032
},
10341033
Rem(block) => EntityModification::Remove { key, block },
10351034
InsC(block, end) => EntityModification::Insert {
10361035
key,
1037-
data: Arc::new(entity! { SCHEMA => id: "one", count: block, vid: vid }),
1036+
data: Arc::new(entity! { SCHEMA => id: "one", count: block }),
10381037
block,
10391038
end: Some(end),
10401039
},
10411040
OvwC(block, end) => EntityModification::Overwrite {
10421041
key,
1043-
data: Arc::new(entity! { SCHEMA => id: "one", count: block, vid: vid }),
1042+
data: Arc::new(entity! { SCHEMA => id: "one", count: block }),
10441043
block,
10451044
end: Some(end),
10461045
},

graph/src/data/store/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ impl Entity {
924924
self.0.insert("vid", value.into())
925925
}
926926

927-
/// Sets the VID if not set. Should be used only for tests.
927+
/// Sets the VID if it's not already set. Should be used only for tests.
928928
#[cfg(debug_assertions)]
929929
pub fn set_vid_if_empty(&mut self) {
930930
let vid = self.get("vid");
@@ -948,7 +948,7 @@ impl Entity {
948948
/// If a key only exists on one entity, the value from that entity is chosen.
949949
/// If a key is set to `Value::Null` in `update`, the key/value pair is removed.
950950
pub fn merge_remove_null_fields(&mut self, update: Entity) -> Result<(), InternError> {
951-
for (key, value) in update.into_iter() {
951+
for (key, value) in update.0.into_iter() {
952952
match value {
953953
Value::Null => self.0.remove(&key),
954954
_ => self.0.insert(&key, value)?,

store/postgres/src/relational_queries.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ impl EntityData {
540540
// block_range that `select *` pulls in but that we
541541
// don't care about here
542542
if key == "vid" {
543-
// VID is not in the input schema but we need it so deserialize it too
543+
// VID is not in the input schema but we need it, so deserialize it too
544544
match T::Value::from_column_value(&ColumnType::Int8, json) {
545545
Ok(value) if value.is_null() => None,
546546
Ok(value) => Some(Ok((Word::from("vid"), value))),

store/test-store/tests/chain/ethereum/manifest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ specVersion: 0.0.2
416416
msg
417417
);
418418

419-
let thing = entity! { schema => id: "datthing", vid: 1i64 };
419+
let thing = entity! { schema => id: "datthing" };
420420
test_store::insert_entities(
421421
&deployment,
422422
vec![(schema.entity_type("Thing").unwrap(), thing)],

store/test-store/tests/core/interfaces.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ async fn reference_interface_derived() {
201201

202202
let query = "query { events { id transaction { id } } }";
203203

204-
let buy = ("BuyEvent", entity! { schema => id: "buy", vid: 0i64 });
205-
let sell1 = ("SellEvent", entity! { schema => id: "sell1", vid: 0i64 });
206-
let sell2 = ("SellEvent", entity! { schema => id: "sell2", vid: 1i64 });
204+
let buy = ("BuyEvent", entity! { schema => id: "buy" });
205+
let sell1 = ("SellEvent", entity! { schema => id: "sell1" });
206+
let sell2 = ("SellEvent", entity! { schema => id: "sell2" });
207207
let gift = (
208208
"GiftEvent",
209209
entity! { schema => id: "gift", transaction: "txn" },

store/test-store/tests/postgres/aggregation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub async fn insert(
8282
.map(|mut data| {
8383
let data_type = schema.entity_type("Data").unwrap();
8484
let key = data_type.key(data.id());
85-
let _ = data.set_vid_if_empty();
85+
data.set_vid_if_empty();
8686
EntityOperation::Set { data, key }
8787
})
8888
.collect();

store/test-store/tests/postgres/relational_bytes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ fn find_many() {
288288
const ID2: &str = "0xdeadbeef02";
289289
const NAME2: &str = "Moo";
290290
insert_thing(&mut conn, layout, ID, NAME, 0);
291-
insert_thing(&mut conn, layout, ID2, NAME2, 1);
291+
insert_thing(&mut conn, layout, ID2, NAME2, 0);
292292

293293
let mut id_map = BTreeMap::default();
294294
let ids = IdList::try_from_iter(
@@ -336,7 +336,7 @@ fn update() {
336336
.expect("Failed to read Thing[deadbeef]")
337337
.unwrap();
338338

339-
assert_entity_eq!(scrub(&entity), actual);
339+
assert_entity_eq!(entity, actual);
340340
});
341341
}
342342

0 commit comments

Comments
 (0)