Skip to content

Commit

Permalink
Add MultiTransaction.run which takes TransactionPayload.
Browse files Browse the repository at this point in the history
For user who constructs the payload directly in Rust, this is slightly
easier.
  • Loading branch information
liangxianzhe committed Mar 2, 2024
1 parent 7adfc6c commit 122e0a0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cozo-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,16 @@ pub struct MultiTransaction {

impl MultiTransaction {
/// Runs a single script in the transaction.
pub fn run( &self, payload: TransactionPayload) -> Result<NamedRows> {
if let Err(err) = self.sender.send(payload) {
bail!(err);
}
match self.receiver.recv() {
Ok(r) => r,
Err(err) => bail!(err),
}
}
/// Runs a single script in the transaction. Same as run but takes query string and parameters.
pub fn run_script(
&self,
payload: &str,
Expand Down

0 comments on commit 122e0a0

Please sign in to comment.