Skip to content

Commit

Permalink
adjust docs for new module structure
Browse files Browse the repository at this point in the history
  • Loading branch information
wprzytula authored and Lorak-mmk committed Sep 26, 2023
1 parent b0ef855 commit 8bc6fa2
Show file tree
Hide file tree
Showing 20 changed files with 43 additions and 44 deletions.
2 changes: 1 addition & 1 deletion docs/source/data-types/counter.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# use std::error::Error;
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::IntoTypedRows;
use scylla::frame::value::Counter;
use scylla::cql::value::Counter;

// Read counter from the table
if let Some(rows) = session.query("SELECT c FROM keyspace.table", &[]).await?.rows {
Expand Down
7 changes: 3 additions & 4 deletions docs/source/data-types/date.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Date

For most use cases `Date` can be represented as
For most use cases `Date` can be represented as
[`chrono::NaiveDate`](https://docs.rs/chrono/0.4.19/chrono/naive/struct.NaiveDate.html).\
`NaiveDate` supports dates from -262145-1-1 to 262143-12-31.

Expand Down Expand Up @@ -40,11 +40,10 @@ Internally `Date` is represented as number of days since -5877641-06-23 i.e. 2^3
# use scylla::Session;
# use std::error::Error;
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::frame::value::Date;
use scylla::frame::response::result::CqlValue;
use scylla::cql::value::{CqlValue, Date};

// Insert date using raw u32 representation
let to_insert: Date = Date(2_u32.pow(31)); // 1970-01-01
let to_insert: Date = Date(2_u32.pow(31)); // 1970-01-01
session
.query("INSERT INTO keyspace.table (a) VALUES(?)", (to_insert,))
.await?;
Expand Down
4 changes: 2 additions & 2 deletions docs/source/data-types/duration.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Duration
`Duration` is represented as [`CqlDuration`](https://docs.rs/scylla/latest/scylla/frame/value/struct.CqlDuration.html)\
`Duration` is represented as [`CqlDuration`](https://docs.rs/scylla/latest/scylla/cql/value/struct.CqlDuration.html)\

```rust
# extern crate scylla;
# use scylla::Session;
# use std::error::Error;
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::IntoTypedRows;
use scylla::frame::value::CqlDuration;
use scylla::cql::value::CqlDuration;

// Insert some ip address into the table
let to_insert: CqlDuration = CqlDuration { months: 1, days: 2, nanoseconds: 3 };
Expand Down
4 changes: 2 additions & 2 deletions docs/source/data-types/time.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Time
`Time` is represented as [`chrono::Duration`](https://docs.rs/chrono/0.4.19/chrono/struct.Duration.html)

Internally `Time` is represented as number of nanoseconds since midnight.
Internally `Time` is represented as number of nanoseconds since midnight.
It can't be negative or exceed `86399999999999` (24 hours).

When sending in a query it needs to be wrapped in `value::Time` to differentiate from [`Timestamp`](timestamp.md)
Expand All @@ -13,7 +13,7 @@ When sending in a query it needs to be wrapped in `value::Time` to differentiate
# use std::error::Error;
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::IntoTypedRows;
use scylla::frame::value::Time;
use scylla::cql::value::Time;
use chrono::Duration;

// Insert some time into the table
Expand Down
2 changes: 1 addition & 1 deletion docs/source/data-types/timestamp.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ When sending in a query it needs to be wrapped in `value::Timestamp` to differen
# use std::error::Error;
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::IntoTypedRows;
use scylla::frame::value::Timestamp;
use scylla::cql::value::Timestamp;
use chrono::Duration;

// Insert some timestamp into the table
Expand Down
6 changes: 3 additions & 3 deletions docs/source/execution-profiles/create-and-use.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ To create an `ExecutionProfile` and attach it as default for `Session`:
# async fn check_only_compiles() -> Result<(), Box<dyn Error>> {
use scylla::{Session, SessionBuilder};
use scylla::statement::Consistency;
use scylla::transport::ExecutionProfile;
use scylla::execution::ExecutionProfile;

let profile = ExecutionProfile::builder()
.consistency(Consistency::LocalOne)
Expand All @@ -34,7 +34,7 @@ To create an `ExecutionProfile` and attach it to a `Query`:
# async fn check_only_compiles() -> Result<(), Box<dyn Error>> {
use scylla::query::Query;
use scylla::statement::Consistency;
use scylla::transport::ExecutionProfile;
use scylla::execution::ExecutionProfile;
use std::time::Duration;

let profile = ExecutionProfile::builder()
Expand All @@ -60,7 +60,7 @@ To create an `ExecutionProfile` based on another profile:
# use std::error::Error;
# async fn check_only_compiles() -> Result<(), Box<dyn Error>> {
use scylla::statement::Consistency;
use scylla::transport::ExecutionProfile;
use scylla::execution::ExecutionProfile;
use std::time::Duration;

let base_profile = ExecutionProfile::builder()
Expand Down
4 changes: 2 additions & 2 deletions docs/source/execution-profiles/maximal-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
use scylla::query::Query;
use scylla::speculative_execution::SimpleSpeculativeExecutionPolicy;
use scylla::statement::{Consistency, SerialConsistency};
use scylla::transport::ExecutionProfile;
use scylla::transport::load_balancing::DefaultPolicy;
use scylla::execution::ExecutionProfile;
use scylla::execution::load_balancing::DefaultPolicy;
use scylla::execution::retries::FallthroughRetryPolicy;
use std::{sync::Arc, time::Duration};

Expand Down
2 changes: 1 addition & 1 deletion docs/source/execution-profiles/priority.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Priorities of execution profiles and directly set options:
use scylla::{Session, SessionBuilder};
use scylla::query::Query;
use scylla::statement::Consistency;
use scylla::transport::ExecutionProfile;
use scylla::execution::ExecutionProfile;

let session_profile = ExecutionProfile::builder()
.consistency(Consistency::One)
Expand Down
2 changes: 1 addition & 1 deletion docs/source/execution-profiles/remap.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Below, the remaps described above are followed in code.
use scylla::{Session, SessionBuilder};
use scylla::query::Query;
use scylla::statement::Consistency;
use scylla::transport::ExecutionProfile;
use scylla::execution::ExecutionProfile;

let profile1 = ExecutionProfile::builder()
.consistency(Consistency::One)
Expand Down
4 changes: 2 additions & 2 deletions docs/source/load-balancing/load-balancing.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ balancing plan based on the query information and the state of the cluster.

Load balancing policies do not influence to which nodes connections are
being opened. For a node connection blacklist configuration refer to
`scylla::transport::host_filter::HostFilter`, which can be set session-wide
`scylla::cluster::host_filter::HostFilter`, which can be set session-wide
using `SessionBuilder::host_filter` method.

## Plan
Expand Down Expand Up @@ -49,7 +49,7 @@ The newly created execution profile is then converted to a handle using
# async fn check_only_compiles(uri: &str) -> Result<(), Box<dyn Error>> {
use scylla::SessionBuilder;
use scylla::load_balancing::DefaultPolicy;
use scylla::transport::ExecutionProfile;
use scylla::execution::ExecutionProfile;
use scylla::session::Session;
use std::sync::Arc;

Expand Down
4 changes: 2 additions & 2 deletions docs/source/queries/result.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ session.query("INSERT INTO ks.tab (a) VALUES (0)", &[]).await?.result_not_rows()
For more see [`QueryResult`](https://docs.rs/scylla/latest/scylla/transport/query_result/struct.QueryResult.html)

### `NULL` values
`NULL` values will return an error when parsed as a Rust type.
`NULL` values will return an error when parsed as a Rust type.
To properly handle `NULL` values parse column as an `Option<>`:
```rust
# extern crate scylla;
Expand Down Expand Up @@ -123,7 +123,7 @@ Field names don't need to match column names.
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::IntoTypedRows;
use scylla::macros::FromRow;
use scylla::frame::response::cql_to_rust::FromRow;
use scylla::cql::cql_to_rust::FromRow;

#[derive(FromRow)]
struct MyRow {
Expand Down
2 changes: 1 addition & 1 deletion docs/source/queries/timeouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ However, setting per-statement timeout to `None` results in falling back to per-
# use std::error::Error;
# async fn timeouts() -> Result<(), Box<dyn Error>> {
use scylla::{Session, SessionBuilder, query::Query};
use scylla::transport::ExecutionProfile;
use scylla::execution::ExecutionProfile;
use std::time::Duration;

let uri = std::env::var("SCYLLA_URI")
Expand Down
6 changes: 3 additions & 3 deletions docs/source/queries/values.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Query values
Query text is constant, but the values might change.
You can pass changing values to a query by specifying a list of variables as bound values.\
Each `?` in query text will be filled with the matching value.
Each `?` in query text will be filled with the matching value.

> **Never** pass values by adding strings, this could lead to [SQL Injection](https://en.wikipedia.org/wiki/SQL_injection)
Expand All @@ -12,7 +12,7 @@ or a custom struct which derives from `ValueList`.
A few examples:
```rust
# extern crate scylla;
# use scylla::{Session, ValueList, frame::response::result::CqlValue};
# use scylla::{Session, ValueList, cql::value::CqlValue};
# use std::error::Error;
# use std::collections::HashMap;
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
Expand Down Expand Up @@ -94,7 +94,7 @@ Using `Unset` results in better performance:
# use scylla::Session;
# use std::error::Error;
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::frame::value::{MaybeUnset, Unset};
use scylla::cql::value::{MaybeUnset, Unset};

// Inserting a null results in suboptimal performance
let null_i32: Option<i32> = None;
Expand Down
6 changes: 3 additions & 3 deletions docs/source/retry-policy/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ To use in `Session`:
# use std::error::Error;
# async fn check_only_compiles() -> Result<(), Box<dyn Error>> {
use scylla::{Session, SessionBuilder};
use scylla::transport::ExecutionProfile;
use scylla::execution::ExecutionProfile;
use scylla::execution::retries::DefaultRetryPolicy;

let handle = ExecutionProfile::builder()
Expand All @@ -36,7 +36,7 @@ To use in a [simple query](../queries/simple.md):
# use std::sync::Arc;
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::query::Query;
use scylla::transport::ExecutionProfile;
use scylla::execution::ExecutionProfile;
use scylla::execution::retries::DefaultRetryPolicy;

// Create a Query manually and set the retry policy
Expand Down Expand Up @@ -65,7 +65,7 @@ To use in a [prepared query](../queries/prepared.md):
# use std::sync::Arc;
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::prepared_statement::PreparedStatement;
use scylla::transport::ExecutionProfile;
use scylla::execution::ExecutionProfile;
use scylla::execution::retries::DefaultRetryPolicy;

// Create PreparedStatement manually and set the retry policy
Expand Down
12 changes: 6 additions & 6 deletions docs/source/retry-policy/downgrading-consistency.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ To use in `Session`:
# use std::error::Error;
# async fn check_only_compiles() -> Result<(), Box<dyn Error>> {
use scylla::{Session, SessionBuilder};
use scylla::transport::ExecutionProfile;
use scylla::transport::downgrading_consistency_retry_policy::DowngradingConsistencyRetryPolicy;
use scylla::execution::ExecutionProfile;
use scylla::execution::retries::DowngradingConsistencyRetryPolicy;

let handle = ExecutionProfile::builder()
.retry_policy(Box::new(DowngradingConsistencyRetryPolicy::new()))
Expand All @@ -76,8 +76,8 @@ To use in a [simple query](../queries/simple.md):
# use std::error::Error;
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::query::Query;
use scylla::transport::ExecutionProfile;
use scylla::transport::downgrading_consistency_retry_policy::DowngradingConsistencyRetryPolicy;
use scylla::execution::ExecutionProfile;
use scylla::execution::retries::DowngradingConsistencyRetryPolicy;

let handle = ExecutionProfile::builder()
.retry_policy(Box::new(DowngradingConsistencyRetryPolicy::new()))
Expand All @@ -102,8 +102,8 @@ To use in a [prepared query](../queries/prepared.md):
# use std::error::Error;
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::prepared_statement::PreparedStatement;
use scylla::transport::ExecutionProfile;
use scylla::transport::downgrading_consistency_retry_policy::DowngradingConsistencyRetryPolicy;
use scylla::execution::ExecutionProfile;
use scylla::execution::retries::DowngradingConsistencyRetryPolicy;

let handle = ExecutionProfile::builder()
.retry_policy(Box::new(DowngradingConsistencyRetryPolicy::new()))
Expand Down
6 changes: 3 additions & 3 deletions docs/source/retry-policy/fallthrough.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ To use in `Session`:
# use std::error::Error;
# async fn check_only_compiles() -> Result<(), Box<dyn Error>> {
use scylla::{Session, SessionBuilder};
use scylla::transport::ExecutionProfile;
use scylla::execution::ExecutionProfile;
use scylla::execution::retries::FallthroughRetryPolicy;

let handle = ExecutionProfile::builder()
Expand All @@ -34,7 +34,7 @@ To use in a [simple query](../queries/simple.md):
# use std::error::Error;
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::query::Query;
use scylla::transport::ExecutionProfile;
use scylla::execution::ExecutionProfile;
use scylla::execution::retries::FallthroughRetryPolicy;

let handle = ExecutionProfile::builder()
Expand All @@ -60,7 +60,7 @@ To use in a [prepared query](../queries/prepared.md):
# use std::error::Error;
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::prepared_statement::PreparedStatement;
use scylla::transport::ExecutionProfile;
use scylla::execution::ExecutionProfile;
use scylla::execution::retries::FallthroughRetryPolicy;

let handle = ExecutionProfile::builder()
Expand Down
6 changes: 3 additions & 3 deletions docs/source/tracing/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ return a `QueryResult` which contains a `tracing_id` if tracing was enabled.
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::query::Query;
use scylla::QueryResult;
use scylla::tracing::TracingInfo;
use scylla::execution::tracing::TracingInfo;
use uuid::Uuid;

// Create a Query manually and enable tracing
Expand Down Expand Up @@ -40,7 +40,7 @@ if let Some(id) = tracing_id {
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::prepared_statement::PreparedStatement;
use scylla::QueryResult;
use scylla::tracing::TracingInfo;
use scylla::execution::tracing::TracingInfo;
use uuid::Uuid;

// Prepare the query
Expand Down Expand Up @@ -72,7 +72,7 @@ if let Some(id) = tracing_id {
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::batch::Batch;
use scylla::QueryResult;
use scylla::tracing::TracingInfo;
use scylla::execution::tracing::TracingInfo;
use uuid::Uuid;

// Create a batch statement
Expand Down
4 changes: 2 additions & 2 deletions docs/source/tracing/paged.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ If tracing is enabled the row iterator will contain a list of tracing ids for al
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::query::Query;
use scylla::execution::iterator::RowIterator;
use scylla::tracing::TracingInfo;
use scylla::execution::tracing::TracingInfo;
use futures::StreamExt;
use uuid::Uuid;

Expand Down Expand Up @@ -50,7 +50,7 @@ for id in tracing_ids {
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::prepared_statement::PreparedStatement;
use scylla::execution::iterator::RowIterator;
use scylla::tracing::TracingInfo;
use scylla::execution::tracing::TracingInfo;
use futures::StreamExt;
use uuid::Uuid;

Expand Down
2 changes: 1 addition & 1 deletion docs/source/tracing/prepare.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::query::Query;
use scylla::prepared_statement::PreparedStatement;
use scylla::tracing::TracingInfo;
use scylla::execution::tracing::TracingInfo;
use uuid::Uuid;

// Prepare the query with tracing enabled
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tracing/query-history.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This history includes all requests sent, decisions to retry and speculative exec
# use std::error::Error;
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::query::Query;
use scylla::history::{HistoryCollector, StructuredHistory};
use scylla::execution::history::{HistoryCollector, StructuredHistory};
use std::sync::Arc;

// Create a query for which we would like to trace the history of its execution
Expand Down

0 comments on commit 8bc6fa2

Please sign in to comment.