Enum tidb_query_datatype::codec::datum::Datum [−][src]
Datum
stores data with different types.
Variants
I64(i64)
U64(u64)
F64(f64)
Dur(Duration)
Dec(Decimal)
Time(Time)
Json(Json)
Enum(Enum)
Set(Set)
Implementations
impl Datum
[src]
pub fn as_int(&self) -> Result<Option<i64>>
[src]
pub fn as_real(&self) -> Result<Option<f64>>
[src]
pub fn as_decimal(&self) -> Result<Option<Cow<'_, Decimal>>>
[src]
pub fn as_string(&self) -> Result<Option<Cow<'_, [u8]>>>
[src]
pub fn as_time(&self) -> Result<Option<Cow<'_, Time>>>
[src]
pub fn as_duration(&self) -> Result<Option<Duration>>
[src]
pub fn as_json(&self) -> Result<Option<Cow<'_, Json>>>
[src]
impl Datum
[src]
pub fn cmp(&self, ctx: &mut EvalContext, datum: &Datum) -> Result<Ordering>
[src]
cmp
compares the datum and returns an Ordering.
fn cmp_i64(&self, ctx: &mut EvalContext, i: i64) -> Result<Ordering>
[src]
fn cmp_u64(&self, ctx: &mut EvalContext, u: u64) -> Result<Ordering>
[src]
fn cmp_f64(&self, ctx: &mut EvalContext, f: f64) -> Result<Ordering>
[src]
fn cmp_bytes(&self, ctx: &mut EvalContext, bs: &[u8]) -> Result<Ordering>
[src]
fn cmp_dec(&self, ctx: &mut EvalContext, dec: &Decimal) -> Result<Ordering>
[src]
fn cmp_dur(&self, ctx: &mut EvalContext, d: Duration) -> Result<Ordering>
[src]
fn cmp_time(&self, ctx: &mut EvalContext, time: Time) -> Result<Ordering>
[src]
fn cmp_json(&self, ctx: &mut EvalContext, json: &Json) -> Result<Ordering>
[src]
fn cmp_enum(&self, _ctx: &mut EvalContext, v: &Enum) -> Result<Ordering>
[src]
fn cmp_set(&self, _ctx: &mut EvalContext, v: &Set) -> Result<Ordering>
[src]
pub fn into_bool(self, ctx: &mut EvalContext) -> Result<Option<bool>>
[src]
into_bool
converts self to a bool.
source function name is ToBool
.
pub fn to_string(&self) -> Result<String>
[src]
to_string
returns a string representation of the datum.
pub fn into_string(self) -> Result<String>
[src]
into_string convert self into a string.
source function name is ToString
.
pub fn into_f64(self, ctx: &mut EvalContext) -> Result<f64>
[src]
into_f64
converts self into f64.
source function name is ToFloat64
.
pub fn into_i64(self, ctx: &mut EvalContext) -> Result<i64>
[src]
into_i64
converts self into i64.
source function name is ToInt64
.
pub fn f64(&self) -> f64
[src]
Keep compatible with TiDB’s GetFloat64
function.
pub fn i64(&self) -> i64
[src]
Keep compatible with TiDB’s GetInt64
function.
pub fn u64(&self) -> u64
[src]
Keep compatible with TiDB’s GetUint64
function.
pub fn into_arith(self, ctx: &mut EvalContext) -> Result<Datum>
[src]
into_arith converts datum to appropriate datum for arithmetic computing.
Keep compatible with TiDB’s CoerceArithmetic
function.
pub fn into_dec(self) -> Result<Decimal>
[src]
Keep compatible with TiDB’s ToDecimal
function.
FIXME: the EvalContext
should be passed by caller
pub fn cast_as_json(self) -> Result<Json>
[src]
cast_as_json converts Datum::Bytes(bs) into Json::from_str(bs) and Datum::Null would be illegal. It would be used in cast, json_merge,json_extract,json_type mysql> SELECT CAST(‘null’ AS JSON); +–––––––––––+ | CAST(‘null’ AS JSON) | +–––––––––––+ | null | +–––––––––––+
pub fn into_json(self) -> Result<Json>
[src]
into_json would convert Datum::Bytes(bs) into Json::from_string(bs) and convert Datum::Null into Json::none(). This func would be used in json_unquote and json_modify
pub fn to_json_path_expr(&self) -> Result<PathExpression>
[src]
to_json_path_expr
parses Datum::Bytes(b) to a JSON PathExpression.
fn coerce_to_dec(self) -> Result<Datum>
[src]
Try its best effort to convert into a decimal datum.
source function name is ConvertDatumToDecimal
.
fn coerce_to_f64(self, ctx: &mut EvalContext) -> Result<Datum>
[src]
Try its best effort to convert into a f64 datum.
pub fn coerce(
ctx: &mut EvalContext,
left: Datum,
right: Datum
) -> Result<(Datum, Datum)>
[src]
ctx: &mut EvalContext,
left: Datum,
right: Datum
) -> Result<(Datum, Datum)>
coerce
changes type.
If left or right is F64, changes the both to F64.
Else if left or right is Decimal, changes the both to Decimal.
Keep compatible with TiDB’s CoerceDatum
function.
pub fn checked_div(self, ctx: &mut EvalContext, d: Datum) -> Result<Datum>
[src]
checked_div
computes the result of self / d
.
pub fn checked_add(self, _: &mut EvalContext, d: Datum) -> Result<Datum>
[src]
Keep compatible with TiDB’s ComputePlus
function.
pub fn checked_minus(self, _: &mut EvalContext, d: Datum) -> Result<Datum>
[src]
checked_minus
computes the result of self - d
.
pub fn checked_mul(self, _: &mut EvalContext, d: Datum) -> Result<Datum>
[src]
pub fn checked_rem(self, _: &mut EvalContext, d: Datum) -> Result<Datum>
[src]
pub fn checked_int_div(self, _: &mut EvalContext, datum: Datum) -> Result<Datum>
[src]
Trait Implementations
impl Clone for Datum
[src]
impl Debug for Datum
[src]
impl Display for Datum
[src]
impl<'a> From<&'a [u8]> for Datum
[src]
impl<'a> From<Cow<'a, [u8]>> for Datum
[src]
impl<'a, T: Clone + Into<Datum>> From<Cow<'a, T>> for Datum
[src]
impl From<Decimal> for Datum
[src]
impl From<Duration> for Datum
[src]
impl From<Json> for Datum
[src]
impl<T: Into<Datum>> From<Option<T>> for Datum
[src]
impl From<Time> for Datum
[src]
impl From<Vec<u8, Global>> for Datum
[src]
impl From<bool> for Datum
[src]
impl From<f64> for Datum
[src]
impl From<i64> for Datum
[src]
impl From<u64> for Datum
[src]
impl PartialEq<Datum> for Datum
[src]
impl StructuralPartialEq for Datum
[src]
Auto Trait Implementations
impl RefUnwindSafe for Datum
impl Send for Datum
impl Sync for Datum
impl Unpin for Datum
impl UnwindSafe for Datum
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<V, W> ConvertFrom<W> for V where
W: ConvertTo<V>,
[src]
W: ConvertTo<V>,
pub fn convert_from(&mut EvalContext, W) -> Result<V, Error>
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
[src]
pub const ALIGN: usize
[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
[src]
pub unsafe fn drop(ptr: usize)
[src]
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T> Sealed<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
[src]
T: Send + Sync + UnwindSafe + ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,