pub enum Value {
Show 24 variants
Null,
Bool(bool),
Int(i64),
UInt(u64),
Int128(i128),
UInt128(u128),
BigInt(String),
Float32(f32),
Float64(f64),
Decimal(String),
String(Vec<u8>),
Uuid(Uuid),
Date(i32),
DateTime {
secs: i64,
tz: Option<Arc<str>>,
},
DateTime64 {
ticks: i64,
precision: u8,
tz: Option<Arc<str>>,
},
Time(i64),
Time64 {
ticks: i64,
precision: u8,
},
Enum(String),
Ipv4(Ipv4Addr),
Ipv6(Ipv6Addr),
Array(Vec<Value>),
Tuple(Vec<Value>),
Map(Vec<(Value, Value)>),
Json(String),
}Expand description
One ClickHouse value. See the design’s type table for which column types decode to which variant.
Variants§
Null
Bool(bool)
Int(i64)
Int8–Int64 (and Interval*).
UInt(u64)
UInt8–UInt64.
Int128(i128)
UInt128(u128)
BigInt(String)
Int256/UInt256, as decimal text.
Float32(f32)
Float64(f64)
Decimal(String)
A decimal’s exact text, such as "-12.30".
String(Vec<u8>)
String and FixedString: bytes, not necessarily UTF-8.
Uuid(Uuid)
Date(i32)
Date/Date32: days since 1970-01-01.
DateTime
DateTime: seconds since the epoch, and the column’s time zone.
DateTime64
DateTime64(precision): ticks of 10^-precision seconds since the epoch.
Time(i64)
Time: seconds.
Time64
Time64(precision): ticks of 10^-precision seconds.
Enum(String)
An enum’s name.
Ipv4(Ipv4Addr)
Ipv6(Ipv6Addr)
Array(Vec<Value>)
Tuple(Vec<Value>)
Map(Vec<(Value, Value)>)
Json(String)
A JSON column’s text.
Implementations§
Source§impl Value
impl Value
Sourcepub fn timestamp_micros(micros: i64) -> Value
pub fn timestamp_micros(micros: i64) -> Value
A UTC timestamp in microseconds, as SDKs pass their time values.
Sourcepub fn as_naive_date(days: i32) -> Option<NaiveDate>
pub fn as_naive_date(days: i32) -> Option<NaiveDate>
The date of a Date value.
Sourcepub fn epoch(&self) -> Option<(i64, u32)>
pub fn epoch(&self) -> Option<(i64, u32)>
Seconds and nanoseconds since the epoch of a DateTime/DateTime64.
Sourcepub fn to_param_text(&self) -> Vec<u8> ⓘ
pub fn to_param_text(&self) -> Vec<u8> ⓘ
The value as the text of a query parameter (param_<name>), which
ClickHouse parses as its declared type in the Escaped format.
Sourcepub fn write_json(&self, out: &mut String)
pub fn write_json(&self, out: &mut String)
The value as JSON for a JSONEachRow insert.
Sourcepub fn display_text(&self) -> String
pub fn display_text(&self) -> String
The value as display text, for tables in tools: strings unquoted, composites in ClickHouse’s own literal syntax.
Sourcepub fn calendar_text(&self) -> String
pub fn calendar_text(&self) -> String
A timestamp as calendar text in UTC, with the column’s precision.
Sourcepub fn to_display_json(&self) -> Value
pub fn to_display_json(&self) -> Value
The value as JSON for tools and the explorer: like an insert’s, but timestamps as calendar text and 64-bit and wider integers as strings when they don’t fit a double exactly.
Trait Implementations§
impl ArrayElement for Value
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Forget for Value
impl Freeze for Value
impl Move for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request