Module tidb_query_datatype::codec::convert[][src]

Traits

ConvertFrom
ConvertTo

A trait for converting a value to T

ToInt

A trait for converting a value to an Int.

Functions

bytes_to_int_without_context

bytes_to_int_without_context converts a byte arrays to an i64 in best effort, but without context.

bytes_to_uint_without_context

bytes_to_uint_without_context converts a byte arrays to an iu64 in best effort, but without context.

decimal_as_u64
exp_float_str_to_int_str
float_str_to_int_string

It converts a valid float string into valid integer string which can be parsed by i64::from_str, we can’t parse float first then convert it to string because precision will be lost.

get_valid_float_prefix
get_valid_int_prefix
get_valid_utf8_prefix
integer_signed_lower_bound

Returns the min i64 values of different mysql types

integer_signed_upper_bound

Returns the max i64 values of different mysql types

integer_unsigned_upper_bound

Returns the max u64 values of different mysql types

no_exp_float_str_to_int_str
overflow

Returns an overflowed error.

pad_zero_for_binary_type
produce_dec_with_specified_tp
produce_float_with_specified_tp

produce_float_with_specified_tp(ProduceFloatWithSpecifiedTp in TiDB) produces a new float64 according to flen and decimal in self.tp. TODO port tests from TiDB(TiDB haven’t implemented now)

produce_str_with_specified_tp

produce_str_with_specified_tp(ProduceStrWithSpecifiedTp in TiDB) produces a new string according to flen and chs.

round_decimal_with_ctx
round_int_str

the s must be a valid int_str

truncate_binary

truncate_binary truncates a buffer to the specified length.

truncate_f64

truncate_f64 (TruncateFloat in TiDB) tries to truncate f. If the result exceeds the max/min float that flen/decimal allowed, returns the max/min float allowed.