Skip to content

Commit 7cd5eef

Browse files
Centrilkulakowski
authored andcommitted
InstanceEnv::delete_by_col_eq: return u32 instead of NonZeroU32 (#539)
1 parent 5ec7eeb commit 7cd5eef

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

crates/core/src/host/instance_env.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use nonempty::NonEmpty;
22
use parking_lot::{Mutex, MutexGuard};
33
use spacetimedb_lib::{bsatn, ProductValue};
4-
use std::num::NonZeroU32;
54
use std::ops::DerefMut;
65
use std::sync::Arc;
76

@@ -159,7 +158,7 @@ impl InstanceEnv {
159158
table_id: TableId,
160159
col_id: ColId,
161160
value: &[u8],
162-
) -> Result<NonZeroU32, NodesError> {
161+
) -> Result<u32, NodesError> {
163162
let stdb = &*self.dbic.relational_db;
164163
let tx = &mut *self.get_tx()?;
165164

@@ -172,9 +171,8 @@ impl InstanceEnv {
172171
.map(|x| RowId(*x.id()))
173172
.collect::<Vec<_>>();
174173

175-
// Delete them and count how many we deleted and error if none.
176-
let count = stdb.delete(tx, table_id, rows_to_delete);
177-
NonZeroU32::new(count).ok_or(NodesError::ColumnValueNotFound)
174+
// Delete them and count how many we deleted.
175+
Ok(stdb.delete(tx, table_id, rows_to_delete))
178176
}
179177

180178
/// Deletes all rows in the table identified by `table_id`

crates/core/src/host/wasmer/wasm_instance_env.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ impl WasmInstanceEnv {
481481
.data()
482482
.instance_env
483483
.delete_by_col_eq(&ctx, table_id.into(), col_id.into(), &value)?;
484-
Ok(count.get())
484+
Ok(count)
485485
},
486486
)
487487
}

0 commit comments

Comments
 (0)