MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / transaction

Method transaction

crates/opencode-storage/src/database.rs:79–90  ·  view source on GitHub ↗
(&self, f: F)

Source from the content-addressed store, hash-verified

77 }
78
79 pub async fn transaction<F, T, Fut>(&self, f: F) -> Result<T, DatabaseError>
80 where
81 F: FnOnce(&mut SqliteTransaction<'_>) -> Fut,
82 Fut: Future<Output = Result<T, DatabaseError>>,
83 {
84 let mut tx = self.begin().await?;
85 let result = f(&mut tx).await?;
86 tx.commit()
87 .await
88 .map_err(|e| DatabaseError::TransactionError(e.to_string()))?;
89 Ok(result)
90 }
91
92 pub async fn get_connection(&self) -> Result<SqliteConnection, DatabaseError> {
93 self.pool

Callers

nothing calls this directly

Calls 1

beginMethod · 0.80

Tested by

no test coverage detected