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

pub trait ToInt {
    fn to_int(&self, ctx: &mut EvalContext, tp: FieldTypeTp) -> Result<i64>;
fn to_uint(&self, ctx: &mut EvalContext, tp: FieldTypeTp) -> Result<u64>; }

A trait for converting a value to an Int.

Required methods

fn to_int(&self, ctx: &mut EvalContext, tp: FieldTypeTp) -> Result<i64>[src]

Converts the given value to an i64

fn to_uint(&self, ctx: &mut EvalContext, tp: FieldTypeTp) -> Result<u64>[src]

Converts the given value to an u64

Loading content...

Implementations on Foreign Types

impl ToInt for i64[src]

impl ToInt for u64[src]

impl ToInt for f64[src]

fn to_int(&self, ctx: &mut EvalContext, tp: FieldTypeTp) -> Result<i64>[src]

This function is ported from TiDB’s types.ConvertFloatToInt, which checks whether the number overflows the signed lower and upper boundaries of tp

Notes

It handles overflows using ctx so that the caller would not handle it anymore.

fn to_uint(&self, ctx: &mut EvalContext, tp: FieldTypeTp) -> Result<u64>[src]

This function is ported from TiDB’s types.ConvertFloatToUint, which checks whether the number overflows the unsigned upper boundaries of tp

Notes

It handles overflows using ctx so that the caller would not handle it anymore.

impl ToInt for &[u8][src]

fn to_int(&self, ctx: &mut EvalContext, tp: FieldTypeTp) -> Result<i64>[src]

Port from TiDB’s types.StrToInt

fn to_uint(&self, ctx: &mut EvalContext, tp: FieldTypeTp) -> Result<u64>[src]

Port from TiDB’s types.StrToUint

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

Loading content...

Implementors

impl ToInt for Decimal[src]

impl ToInt for Duration[src]

impl ToInt for Json[src]

impl ToInt for DateTime[src]

impl ToInt for Bytes[src]

impl ToInt for Real[src]

impl<'a> ToInt for EnumRef<'a>[src]

impl<'a> ToInt for JsonRef<'a>[src]

Loading content...