-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve docs for data types comparison table
- Loading branch information
1 parent
67e9cf1
commit 5854af0
Showing
2 changed files
with
77 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,37 @@ | ||
# Data types comparison table | ||
# Data Types Comparison Table | ||
|
||
This page contains a table that compares the data types used by Cassandra with their counterparts used by Xandra. Each Cassandra data type corresponds to one or more Elixir data types. What Elixir data type is used for a given Cassandra type is often controlled by a formatting option. For example, a `date` value from Cassandra can be returned as a `Date.t()` struct or as an integer representing the number of days since the Unix epoch depending on the `:date_format` option passed to various Xandra functions. | ||
|
||
## Comparison table | ||
## Comparison Table | ||
|
||
| Cassandra data type | Elixir data type | | ||
|-------------------------------------------------------------|------------------------------------------------------------| | ||
| `NULL` | `nil` | | ||
| `bool` | `boolean()` | | ||
| `float`, `double` | `float()` | | ||
| `int`, `bigint`, `smallint`, `varint`, `tinyint`, `counter` | `integer()` | | ||
| `decimal` | `Decimal.t()`, `{value, scale}` | | ||
| `ascii`, `varchar`, `text` | `String.t()` | | ||
| `blob` | `binary()` | | ||
| `date` | `Date.t()`, `integer()` (days from Unix epoch) | | ||
| `timestamp` | `DateTime.t()`, `integer()` (milliseconds from Unix epoch) | | ||
| `time` | `Time.t()`, `integer()` (nanoseconds from midnight) | | ||
| `list` | `list()` | | ||
| `tuple` | `tuple()` | | ||
| `set` | `MapSet.t()` | | ||
| `map` | `map()` | | ||
| `uuid`, `timeuuid` | `binary()` | | ||
| Cassandra data type | Elixir data type | | ||
| ------------------- | -------------------------------------------------------------------------------- | | ||
| `ascii` | `t:String.t/0` | | ||
| `bigint` | `t:integer/0` | | ||
| `blob` | `t:binary/0` | | ||
| `boolean` | `t:boolean/0` | | ||
| `counter` | `t:integer/0` | | ||
| `date` | `t:Date.t/0` (if `date_format: :date`) | | ||
| `date` | `t:integer/0` (if `date_format: :integer`), days from Unix epoch | | ||
| `decimal` | `{value, scale}` (if `decimal_format: :tuple`), where `value * 10^(-1 * scale)` | | ||
| `decimal` | `t:Decimal.t/0` (if `decimal_format: :decimal`) | | ||
| `double` | `t:float/0` | | ||
| `float` | `t:float/0` | | ||
| `inet` | `t::inet.ip_address/0` | | ||
| `int` | `t:integer/0` | | ||
| `list<T>` | `t:list/0` | | ||
| `map<KeyT, ValueT>` | `t:map/0` | | ||
| `NULL` | `nil` | | ||
| `set<T>` | `t:MapSet.t/0` | | ||
| `smallint` | `t:integer/0` | | ||
| `text` | `t:String.t/0` | | ||
| `time` | `t:integer/0` (if `time_format: :integer`), as nanoseconds from midnight | | ||
| `time` | `t:Time.t/0` (if `time_format: :time`) | | ||
| `timestamp` | `t:DateTime.t/0` (if `timestamp_format: :datetime`) | | ||
| `timestamp` | `t:integer/0` (if `timestamp_format: :integer`), as milliseconds from Unix epoch | | ||
| `timeuuid` | `t:binary/0` | | ||
| `tinyint` | `t:integer/0` | | ||
| `tuple<...>` | `t:tuple/0` | | ||
| `uuid` | `t:binary/0` | | ||
| `varchar` | `t:String.t/0` | | ||
| `varint` | `t:integer/0` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters