Skip to content

Commit e1c9852

Browse files
committed
Merge branch '0.26.1-scylladb'
2 parents 2cc0138 + 60f9573 commit e1c9852

14 files changed

+574
-406
lines changed

Cargo.lock

+53-65
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "latte-cli"
33
description = "A database benchmarking tool for Apache Cassandra"
4-
version = "0.25.2-scylladb"
4+
version = "0.26.1-scylladb"
55
authors = ["Piotr Kołaczkowski <[email protected]>"]
66
edition = "2021"
77
readme = "README.md"
@@ -14,19 +14,18 @@ path = "src/main.rs"
1414
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1515
[dependencies]
1616
anyhow = "1.0"
17-
base64 = "0.21"
17+
base64 = "0.22"
1818
rmp = "0.8.10"
1919
rmp-serde = "1.0.0-beta.2"
2020
chrono = { version = "0.4.18", features = ["serde"] }
2121
clap = { version = "4", features = ["derive", "cargo", "env"] }
2222
console = "0.15.0"
2323
cpu-time = "1.0.0"
24-
ctrlc = "3.2.1"
2524
err-derive = "0.3"
2625
futures = "0.3"
2726
hdrhistogram = "7.1.0"
2827
hytra = "0.1.2"
29-
itertools = "0.12"
28+
itertools = "0.13"
3029
jemallocator = "0.5"
3130
lazy_static = "1.4.0"
3231
metrohash = "1.0"
@@ -43,13 +42,13 @@ scylla = { version = "0.13", features = ["ssl"] }
4342
search_path = "0.1"
4443
serde = { version = "1.0.116", features = ["derive"] }
4544
serde_json = "1.0.57"
46-
statrs = "0.16"
45+
statrs = "0.17"
4746
status-line = "0.2.0"
4847
strum = { version = "0.26", features = ["derive"] }
4948
strum_macros = "0.26"
5049
time = "0.3"
5150
thiserror = "1.0.26"
52-
tokio = { version = "1", features = ["rt", "rt-multi-thread", "time", "parking_lot"] }
51+
tokio = { version = "1", features = ["rt", "rt-multi-thread", "time", "parking_lot", "signal"] }
5352
tokio-stream = "0.1"
5453
tracing = "0.1"
5554
tracing-subscriber = "0.3"

README.md

+27-12
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,19 @@ pub async fn run(ctx, i) {
170170
}
171171
```
172172
173+
Query parameters can be bound and passed by names as well:
174+
```rust
175+
const INSERT = "my_insert";
176+
177+
pub async fn prepare(ctx) {
178+
ctx.prepare(INSERT, "INSERT INTO test.test(id, data) VALUES (:id, :data)").await?;
179+
}
180+
181+
pub async fn run(ctx, i) {
182+
ctx.execute_prepared(INSERT, #{id: 5, data: "foo"}).await
183+
}
184+
```
185+
173186
### Populating the database
174187
175188
Read queries are more interesting when they return non-empty result sets.
@@ -209,18 +222,20 @@ are pure, i.e. invoking them multiple times with the same parameters yields alwa
209222
- `latte::hash_select(i, vector)` – selects an item from a vector based on a hash
210223
- `latte::blob(i, len)` – generates a random binary blob of length `len`
211224
- `latte::normal(i, mean, std_dev)` – generates a floating point number from a normal distribution
212-
213-
#### Numeric conversions
214-
215-
Rune represents integers as 64-bit signed values. Therefore, it is possible to directly pass a Rune integer to
216-
a Cassandra column of type `bigint`. However, binding a 64-bit value to smaller integer column types, like
217-
`int`, `smallint` or `tinyint` will result in a runtime error. As long as an integer value does not exceed the bounds,
218-
you can convert it to smaller signed integer types by using the following instance functions:
219-
220-
- `x.to_i32()` – converts a float or integer to a 32-bit signed integer, compatible with Cassandra `int` type
221-
- `x.to_i16()` – converts a float or integer to a 16-bit signed integer, compatible with Cassandra `smallint` type
222-
- `x.to_i8()` – converts a float or integer to an 8-bit signed integer, compatible with Cassandra `tinyint` type
223-
- `x.clamp(min, max)` – restricts the range of an integer or a float value to given range
225+
- `latte::uniform(i, min, max)` – generates a floating point number from a uniform distribution
226+
227+
#### Type conversions
228+
Rune uses 64-bit representation for integers and floats.
229+
Since version 0.28 Rune numbers are automatically converted to proper target query parameter type,
230+
therefore you don't need to do explicit conversions. E.g. you can pass an integer as a parameter
231+
of Cassandra type `smallint`. If the number is too big to fit into the range allowed by the target
232+
type, a runtime error will be signalled.
233+
234+
The following methods are available:
235+
- `x.to_integer()` – converts a float to an integer
236+
- `x.to_float()` – converts an integer to a float
237+
- `x.to_string()` – converts a float or integer to a string
238+
- `x.clamp(min, max)` – restricts the range of an integer or a float value to given range
224239
225240
You can also convert between floats and integers by calling `to_integer` or `to_float` instance functions.
226241

0 commit comments

Comments
 (0)