Skip to content

Commit

Permalink
docs: add info about CqlDecimal
Browse files Browse the repository at this point in the history
  • Loading branch information
muzarski committed Jan 26, 2024
1 parent 437a7d5 commit 720aa50
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/source/data-types/data-types.md
Expand Up @@ -26,7 +26,7 @@ Database types and their Rust equivalents:
* `Time` <----> `value::CqlTime`, `chrono::NaiveTime`, `time::Time`
* `Timestamp` <----> `value::CqlTimestamp`, `chrono::DateTime<Utc>`, `time::OffsetDateTime`
* `Duration` <----> `value::CqlDuration`
* `Decimal` <----> `bigdecimal::Decimal`
* `Decimal` <----> `value::CqlDecimal`, `bigdecimal::Decimal` (v0.2.0, v0.3 and v0.4)
* `Varint` <----> `value::CqlVarint`, `num_bigint::BigInt` (v0.3 and v0.4)
* `List` <----> `Vec<T>`
* `Set` <----> `Vec<T>`
Expand Down
11 changes: 10 additions & 1 deletion docs/source/data-types/decimal.md
@@ -1,5 +1,14 @@
# Decimal
`Decimal` is represented as [`bigdecimal::BigDecimal`](https://docs.rs/bigdecimal/0.2.0/bigdecimal/struct.BigDecimal.html)
`Decimal` is represented as `value::CqlDecimal` or [`bigdecimal::BigDecimal`](https://docs.rs/bigdecimal/0.2.0/bigdecimal/struct.BigDecimal.html)

## bigdecimal::BigDecimal

To make use of `bigdecimal::Bigdecimal` type, user should enable one of the available feature flags (`bigdecimal-02`, `bigdecimal-03` or `bigdecimal-04`). They enable support for `bigdecimal::Bigdecimal` v0.2.0, v0.3 and v0.4 accordingly.

## value::CqlDecimal

Without any feature flags, the user can interact with `decimal` type by making use of `value::CqlDecimal` which
is a very simple wrapper representing the value as signed binary number in big-endian order with a 64-bit scale.

```rust
# extern crate scylla;
Expand Down

0 comments on commit 720aa50

Please sign in to comment.