Skip to content

Commit

Permalink
fix(client): doc-test failed introduced by xline-kv#882
Browse files Browse the repository at this point in the history
Signed-off-by: lxl66566 <[email protected]>
  • Loading branch information
lxl66566 committed Jul 19, 2024
1 parent 1c43e5b commit 9713ebd
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 17 deletions.
4 changes: 2 additions & 2 deletions crates/xline-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ To create a xline client:

```rust, no_run
use xline_client::{
types::kv::{PutRequest, RangeRequest},
types::kv::{PutOptions, RangeRequest},
Client, ClientOptions,
};
use anyhow::Result;
Expand All @@ -95,7 +95,7 @@ To create a xline client:
.await?
.kv_client();
client.put(PutRequest::new("key", "value")).await?;
client.put("key", "value", None).await?;
let resp = client.range(RangeRequest::new("key")).await?;
Expand Down
2 changes: 1 addition & 1 deletion crates/xline-client/src/clients/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl AuthClient {
/// # Examples
///
/// ```no_run
/// use xline_client::{types::auth::AuthenticateRequest, Client, ClientOptions};
/// use xline_client::{Client, ClientOptions};
/// use anyhow::Result;
///
/// #[tokio::main]
Expand Down
12 changes: 5 additions & 7 deletions crates/xline-client/src/clients/kv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl KvClient {
/// .kv_client();
///
/// client.put("key1", "value1", None).await?;
/// client.put("key1", "value1", PutOptions::default().with_prev_kv(true)).await?;
/// client.put("key2", "value2", Some(PutOptions::default().with_prev_kv(true))).await?;
///
/// Ok(())
/// }
Expand Down Expand Up @@ -191,7 +191,7 @@ impl KvClient {
///
/// ```no_run
/// use xline_client::{
/// types::kv::{Compare, PutRequest, RangeRequest, TxnOp, TxnRequest, CompareResult},
/// types::kv::{Compare, PutOptions, RangeRequest, TxnOp, TxnRequest, CompareResult},
/// Client, ClientOptions,
/// };
/// use anyhow::Result;
Expand All @@ -207,9 +207,7 @@ impl KvClient {
/// let txn_req = TxnRequest::new()
/// .when(&[Compare::value("key2", CompareResult::Equal, "value2")][..])
/// .and_then(
/// &[TxnOp::put(
/// PutRequest::new("key2", "value3").with_prev_kv(true),
/// )][..],
/// &[TxnOp::put("key2", "value3", Some(PutOptions::default().with_prev_kv(true)))][..],
/// )
/// .or_else(&[TxnOp::range(RangeRequest::new("key2"))][..]);
///
Expand Down Expand Up @@ -249,7 +247,7 @@ impl KvClient {
///
///```no_run
/// use xline_client::{
/// types::kv::{CompactionRequest, PutRequest},
/// types::kv::{CompactionRequest},
/// Client, ClientOptions,
/// };
/// use anyhow::Result;
Expand All @@ -262,7 +260,7 @@ impl KvClient {
/// .await?
/// .kv_client();
///
/// let resp_put = client.put(PutRequest::new("key", "val")).await?;
/// let resp_put = client.put("key", "val", None).await?;
/// let rev = resp_put.header.unwrap().revision;
///
/// let _resp = client.compact(CompactionRequest::new(rev)).await?;
Expand Down
6 changes: 2 additions & 4 deletions crates/xline-client/src/clients/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ impl Xutex {
/// use anyhow::Result;
/// use xline_client::{
/// clients::Xutex,
/// types::kv::{Compare, CompareResult, PutRequest, TxnOp},
/// types::kv::{Compare, CompareResult, PutOptions, TxnOp},
/// Client, ClientOptions,
/// };
///
Expand All @@ -283,9 +283,7 @@ impl Xutex {
/// let txn_req = xutex_guard
/// .txn_check_locked_key()
/// .when([Compare::value("key2", CompareResult::Equal, "value2")])
/// .and_then([TxnOp::put(
/// PutRequest::new("key2", "value3").with_prev_kv(true),
/// )])
/// .and_then([TxnOp::put("key2", "value3", Some(PutOptions::default().with_prev_kv(true)))])
/// .or_else(&[]);
///
/// let _resp = kv_client.txn(txn_req).await?;
Expand Down
4 changes: 2 additions & 2 deletions crates/xline-client/src/clients/watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl WatchClient {
///
/// ```no_run
/// use xline_client::{
/// types::{kv::PutRequest, watch::WatchRequest},
/// types::watch::WatchRequest,
/// Client, ClientOptions,
/// };
/// use anyhow::Result;
Expand All @@ -68,7 +68,7 @@ impl WatchClient {
/// let mut kv_client = client.kv_client();
///
/// let (mut watcher, mut stream) = watch_client.watch(WatchRequest::new("key1")).await?;
/// kv_client.put(PutRequest::new("key1", "value1")).await?;
/// kv_client.put("key1", "value1", None).await?;
///
/// let resp = stream.message().await?.unwrap();
/// let kv = resp.events[0].kv.as_ref().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion crates/xlineapi/proto
Submodule proto updated 0 files

0 comments on commit 9713ebd

Please sign in to comment.