Enum taos_query::common::Ty
source · #[non_exhaustive]#[repr(u8)]pub enum Ty {
Show 15 variants
Bool = 1,
TinyInt = 2,
SmallInt = 3,
Int = 4,
BigInt = 5,
UTinyInt = 11,
USmallInt = 12,
UInt = 13,
UBigInt = 14,
Float = 6,
Double = 7,
Timestamp = 9,
VarChar = 8,
NChar = 10,
Json = 15,
}Expand description
TDengine data type enumeration.
| enum | int | sql name | rust type |
|---|---|---|---|
| Null | 0 | NULL | None |
| Bool | 1 | BOOL | bool |
| TinyInt | 2 | TINYINT | i8 |
| SmallInt | 3 | SMALLINT | i16 |
| Int | 4 | INT | i32 |
| BitInt | 5 | BIGINT | i64 |
| Float | 6 | FLOAT | f32 |
| Double | 7 | DOUBLE | f64 |
| VarChar | 8 | BINARY/VARCHAR | str/String |
| Timestamp | 9 | TIMESTAMP | i64 |
| NChar | 10 | NCHAR | str/String |
| UTinyInt | 11 | TINYINT UNSIGNED | u8 |
| USmallInt | 12 | SMALLINT UNSIGNED | u16 |
| UInt | 13 | INT UNSIGNED | u32 |
| UBigInt | 14 | BIGINT UNSIGNED | u64 |
| Json | 15 | JSON | serde_json::Value |
Note:
- VarChar sql name is BINARY in v2, and VARCHAR in v3.
- Decimal/Blob/MediumBlob is not supported in 2.0/3.0 .
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Bool = 1
The BOOL type in sql, will be represented as bool in Rust.
TinyInt = 2
TINYINT type in sql, will be represented in Rust as i8.
SmallInt = 3
SMALLINT type in sql, will be represented in Rust as i16.
Int = 4
INT type in sql, will be represented in Rust as i32.
BigInt = 5
BIGINT type in sql, will be represented in Rust as i64.
UTinyInt = 11
UTinyInt, tinyint unsigned in sql, u8 in Rust.
USmallInt = 12
12: USmallInt, smallint unsigned in sql, u16 in Rust.
UInt = 13
13: UInt, int unsigned in sql, u32 in Rust.
UBigInt = 14
14: UBigInt, bigint unsigned in sql, u64 in Rust.
Float = 6
6: Float, float type in sql, will be represented in Rust as f32.
Double = 7
7: Double, tinyint type in sql, will be represented in Rust as f64.
Timestamp = 9
9: Timestamp, timestamp type in sql, will be represented as i64 in Rust.
But can be deserialized to chrono::naive::NaiveDateTime or String.
VarChar = 8
8: VarChar, binary type in sql for TDengine 2.x, varchar for TDengine 3.x,
will be represented in Rust as &str or String. This type of data be deserialized to Vec<u8>.
NChar = 10
10: NChar, nchar type in sql, the recommended way in TDengine to store utf-8 String.
Json = 15
15: Json, json tag in sql, will be represented as serde_json::value::Value in Rust.
Implementations§
source§impl Ty
impl Ty
sourcepub const fn is_var_type(&self) -> bool
pub const fn is_var_type(&self) -> bool
Var type is one of Ty::VarChar, Ty::VarBinary, Ty::NChar.
pub const fn is_json(&self) -> bool
sourcepub const fn is_primitive(&self) -> bool
pub const fn is_primitive(&self) -> bool
Is one of boolean/integers/float/double/decimal
sourcepub const fn fixed_length(&self) -> usize
pub const fn fixed_length(&self) -> usize
Get fixed length if the type is primitive.