#[non_exhaustive]#[repr(u8)]pub enum Ty {
Show 17 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,
VarBinary = 16,
Geometry,
}
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 |
VarBinary | 16 | VARBINARY | Vec |
Geometry | 20 | GEOMETRY | Vec |
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.
VarBinary = 16
16, VarBinary, varbinary
in sql, Vec<u8>
in Rust.
Geometry
20, Geometry, geometry
in sql, Vec<u8>
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, Ty::Geometry.
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.
pub const fn lowercase_name(&self) -> &'static str
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Ty
impl<'de> Deserialize<'de> for Ty
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
impl Copy for Ty
impl Eq for Ty
impl StructuralPartialEq for Ty
Auto Trait Implementations§
impl Freeze for Ty
impl RefUnwindSafe for Ty
impl Send for Ty
impl Sync for Ty
impl Unpin for Ty
impl UnwindSafe for Ty
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more