Trait tidb_query_datatype::codec::convert::ConvertTo[][src]

pub trait ConvertTo<T> {
    fn convert(&self, ctx: &mut EvalContext) -> Result<T>;
}

A trait for converting a value to T

Required methods

fn convert(&self, ctx: &mut EvalContext) -> Result<T>[src]

Converts the given value to T value

Loading content...

Implementations on Foreign Types

impl ConvertTo<f64> for i64[src]

impl ConvertTo<f64> for u64[src]

impl ConvertTo<f64> for &[u8][src]

fn convert(&self, ctx: &mut EvalContext) -> Result<f64>[src]

This function parse the str to float, if the num represent by the str is too large, it will handle truncated using ctx, and return f64::MIN or f64::MAX according to whether isNeg of the str

Port from TiDB’s types.StrToFloat

impl ConvertTo<f64> for Cow<'_, [u8]>[src]

impl ConvertTo<Decimal> for i64[src]

impl ConvertTo<Decimal> for u64[src]

impl ConvertTo<Decimal> for f64[src]

fn convert(&self, _: &mut EvalContext) -> Result<Decimal>[src]

Convert a float number to decimal.

This function will use float’s canonical string representation rather than the accurate value the float represent.

impl ConvertTo<Decimal> for &[u8][src]

impl ConvertTo<Decimal> for Cow<'_, [u8]>[src]

impl ConvertTo<Json> for i64[src]

impl ConvertTo<Json> for f64[src]

Loading content...

Implementors

impl ConvertTo<f64> for Decimal[src]

fn convert(&self, _: &mut EvalContext) -> Result<f64>[src]

This function should not return err, if it return err, then the err because of bug.

Port from TiDB’s MyDecimal::ToFloat64.

impl ConvertTo<f64> for Duration[src]

impl ConvertTo<f64> for Json[src]

fn convert(&self, ctx: &mut EvalContext) -> Result<f64>[src]

Keep compatible with TiDB’s ConvertJSONToFloat function.

impl ConvertTo<f64> for Time[src]

fn convert(&self, _: &mut EvalContext) -> Result<f64>[src]

This function should not return err, if it return err, then the err is because of bug.

impl ConvertTo<f64> for Bytes[src]

impl ConvertTo<Decimal> for Duration[src]

fn convert(&self, _: &mut EvalContext) -> Result<Decimal>[src]

This function should not return err, if it return err, then the err is because of bug.

Port from TiDB’ Duration::ToNumber

impl ConvertTo<Decimal> for Json[src]

fn convert(&self, ctx: &mut EvalContext) -> Result<Decimal>[src]

Port from TiDB’s types.ConvertJSONToDecimal

impl ConvertTo<Decimal> for Time[src]

impl ConvertTo<Decimal> for Bytes[src]

impl ConvertTo<Decimal> for Real[src]

impl ConvertTo<Duration> for Time[src]

fn convert(&self, _: &mut EvalContext) -> Result<Duration>[src]

Port from TiDB’s Time::ConvertToDuration

impl ConvertTo<Json> for Decimal[src]

impl ConvertTo<Json> for Duration[src]

impl ConvertTo<Json> for Time[src]

impl ConvertTo<Json> for Real[src]

impl<'a> ConvertTo<f64> for JsonRef<'a>[src]

fn convert(&self, ctx: &mut EvalContext) -> Result<f64>[src]

Keep compatible with TiDB’s ConvertJSONToFloat function.

impl<'a> ConvertTo<NotNan<f64>> for JsonRef<'a>[src]

impl<'a> ConvertTo<Decimal> for JsonRef<'a>[src]

fn convert(&self, ctx: &mut EvalContext) -> Result<Decimal>[src]

Port from TiDB’s types.ConvertJSONToDecimal

impl<'a> ConvertTo<String> for JsonRef<'a>[src]

impl<'a> ConvertTo<Vec<u8, Global>> for EnumRef<'a>[src]

impl<'a> ConvertTo<Vec<u8, Global>> for JsonRef<'a>[src]

impl<T> ConvertTo<i64> for T where
    T: ToInt
[src]

impl<T> ConvertTo<u64> for T where
    T: ToInt
[src]

impl<T> ConvertTo<NotNan<f64>> for T where
    T: ConvertTo<f64> + EvaluableRet
[src]

impl<T> ConvertTo<String> for T where
    T: ToString + EvaluableRet
[src]

impl<T> ConvertTo<Vec<u8, Global>> for T where
    T: ToString + EvaluableRet
[src]

Loading content...