mirror of https://github.com/tikv/client-rust.git
rename txn.set to txn.put
Signed-off-by: ekexium <ekexium@gmail.com>
This commit is contained in:
parent
796cfbaa79
commit
475fe54194
|
@ -9,7 +9,7 @@ async fn puts(client: &Client, pairs: impl IntoIterator<Item = impl Into<KvPair>
|
|||
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");
|
||||
}
|
||||
|
|
|
@ -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<Key>, value: impl Into<Value>) -> Result<()> {
|
||||
pub async fn put(&self, key: impl Into<Key>, value: impl Into<Value>) -> Result<()> {
|
||||
self.buffer.put(key.into(), value.into());
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -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?;
|
||||
|
||||
|
|
Loading…
Reference in New Issue