diff --git a/examples/transaction.rs b/examples/transaction.rs index 515006a..a9ce996 100644 --- a/examples/transaction.rs +++ b/examples/transaction.rs @@ -9,7 +9,7 @@ async fn puts(client: &Client, pairs: impl IntoIterator let mut txn = client.begin().await.expect("Could not begin a transaction"); for pair in pairs { let (key, value) = pair.into().into(); - txn.set(key, value).await.expect("Could not set key value"); + txn.put(key, value).await.expect("Could not set key value"); } txn.commit().await.expect("Could not commit transaction"); } diff --git a/src/transaction/transaction.rs b/src/transaction/transaction.rs index d0063eb..736bbff 100644 --- a/src/transaction/transaction.rs +++ b/src/transaction/transaction.rs @@ -154,12 +154,12 @@ impl Transaction { /// let mut txn = client.begin().await.unwrap(); /// let key = "TiKV".to_owned(); /// let val = "TiKV".to_owned(); - /// txn.set(key, val); + /// txn.put(key, val); /// // Finish the transaction... /// txn.commit().await.unwrap(); /// # }); /// ``` - pub async fn set(&self, key: impl Into, value: impl Into) -> Result<()> { + pub async fn put(&self, key: impl Into, value: impl Into) -> Result<()> { self.buffer.put(key.into(), value.into()); Ok(()) } diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index c07124b..05f5f7b 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -40,8 +40,8 @@ async fn crud() -> Fallible<()> { 0 ); - txn.set("foo".to_owned(), "bar".to_owned()).await?; - txn.set("bar".to_owned(), "foo".to_owned()).await?; + txn.put("foo".to_owned(), "bar".to_owned()).await?; + txn.put("bar".to_owned(), "foo".to_owned()).await?; // Read buffered values assert_eq!( txn.get("foo".to_owned()).await?, @@ -81,7 +81,7 @@ async fn crud() -> Fallible<()> { batch_get_res.get(&Key::from("bar".to_owned())), Some(Value::from("foo".to_owned())).as_ref() ); - txn.set("foo".to_owned(), "foo".to_owned()).await?; + txn.put("foo".to_owned(), "foo".to_owned()).await?; txn.delete("bar".to_owned()).await?; txn.commit().await?;