Skip to content

Commit fb55c45

Browse files
committed
Restore Transaction::new example/docs
Signed-off-by: Nick Cameron <nrc@ncameron.org>
1 parent 5d6175a commit fb55c45

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/transaction/transaction.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@ use std::ops::RangeBounds;
1212
/// particular timestamp obtained from the placement driver.
1313
///
1414
/// Once a transaction is commited, a new commit timestamp is obtained from the placement driver.
15+
///
16+
/// Create a new transaction from a snapshot using `new`.
17+
///
18+
/// ```rust,no_run
19+
/// # #![feature(async_await)]
20+
/// use tikv_client::{Config, transaction::Client};
21+
/// use futures::prelude::*;
22+
/// # futures::executor::block_on(async {
23+
/// let connect = Client::connect(Config::default());
24+
/// let client = connect.await.unwrap();
25+
/// let txn = client.begin();
26+
/// # });
27+
/// ```
1528
#[derive(new)]
1629
pub struct Transaction {
1730
snapshot: Snapshot,

0 commit comments

Comments
 (0)