diff --git a/patch-db/src/model.rs b/patch-db/src/model.rs index 5943c2f..8894b74 100644 --- a/patch-db/src/model.rs +++ b/patch-db/src/model.rs @@ -84,6 +84,15 @@ where } } } +impl Model +where + T: Serialize + for<'de> Deserialize<'de> + Send + Sync, +{ + pub async fn put(&self, tx: &mut Tx, value: &T) -> Result<(), Error> { + self.lock(tx, LockType::Write).await; + tx.put(&self.ptr, value).await + } +} impl From for Model where T: Serialize + for<'de> Deserialize<'de>,