Struct tidb_query_datatype::codec::mysql::json::Json [−][src]
Json implements type json used in tikv by Binary Json.
The Binary Json format from MySQL 5.7 is in the following link:
(https://github.com/mysql/mysql-server/blob/5.7/sql/json_binary.h#L52)
The only difference is that we use large object or large array for
the small corresponding ones. That means in our implementation there
is no difference between small object and big object, so does array.
Fields
type_code: JsonTypevalue: Vec<u8>The binary encoded json data in bytes
Implementations
impl Json[src]
pub fn merge(bjs: Vec<JsonRef<'_>>) -> Result<Json>[src]
merge is the implementation for JSON_MERGE in mysql
https://dev.mysql.com/doc/refman/5.7/en/json-modification-functions.html#function_json-merge
The merge rules are listed as following:
- adjacent arrays are merged to a single array;
- adjacent object are merged to a single object;
- a scalar value is autowrapped as an array before merge;
- an adjacent array and object are merged by autowrapping the object as an array.
See MergeBinary() in TiDB json/binary_function.go
impl Json[src]
pub fn new(tp: JsonType, value: Vec<u8>) -> Self[src]
Creates a new JSON from the type and encoded bytes
pub fn get_type(&self) -> JsonType[src]
Returns the JSON type
pub fn from_string(s: String) -> Result<Self>[src]
Creates a string JSON from a String
pub fn from_str_val(s: &str) -> Result<Self>[src]
Creates a string JSON from a &str
pub fn from_bool(b: bool) -> Result<Self>[src]
Creates a literal JSON from a bool
pub fn from_u64(v: u64) -> Result<Self>[src]
Creates a number JSON from a u64
pub fn from_f64(v: f64) -> Result<Self>[src]
Creates a number JSON from a f64
pub fn from_i64(v: i64) -> Result<Self>[src]
Creates a number JSON from an i64
pub fn from_ref_array(array: Vec<JsonRef<'_>>) -> Result<Self>[src]
Creates a array JSON from a collection of JsonRef
pub fn from_array(array: Vec<Json>) -> Result<Self>[src]
Creates a array JSON from a collection of Json
pub fn from_kv_pairs(entries: Vec<(&[u8], JsonRef<'_>)>) -> Result<Self>[src]
Creates a object JSON from key-value pairs
pub fn from_object(map: BTreeMap<String, Json>) -> Result<Self>[src]
Creates a object JSON from key-value pairs in BTreeMap
pub fn none() -> Result<Self>[src]
Creates a null JSON
pub fn as_ref(&self) -> JsonRef<'_>[src]
Returns a JsonRef points to the starting of encoded bytes
Trait Implementations
impl AsMySQLBool for Json[src]
fn as_mysql_bool(&self, _context: &mut EvalContext) -> Result<bool>[src]
impl ChunkedVec<Json> for ChunkedVecJson[src]
fn from_slice(slice: &[Option<Json>]) -> Self[src]
fn from_vec(data: Vec<Option<Json>>) -> Self[src]
fn push(&mut self, value: Option<Json>)[src]
fn is_empty(&self) -> bool[src]
fn with_capacity(capacity: usize) -> Self[src]
fn push_data(&mut self, value: Json)[src]
fn push_null(&mut self)[src]
fn len(&self) -> usize[src]
fn truncate(&mut self, len: usize)[src]
fn capacity(&self) -> usize[src]
fn append(&mut self, other: &mut Self)[src]
fn to_vec(&self) -> Vec<Option<Json>>[src]
impl Clone for Json[src]
impl ConvertTo<Decimal> for Json[src]
fn convert(&self, ctx: &mut EvalContext) -> Result<Decimal>[src]
Port from TiDB’s types.ConvertJSONToDecimal
impl ConvertTo<Json> for i64[src]
fn convert(&self, _: &mut EvalContext) -> Result<Json>[src]
impl ConvertTo<Json> for f64[src]
fn convert(&self, _: &mut EvalContext) -> Result<Json>[src]
impl ConvertTo<Json> for Real[src]
fn convert(&self, _: &mut EvalContext) -> Result<Json>[src]
impl ConvertTo<Json> for Decimal[src]
fn convert(&self, ctx: &mut EvalContext) -> Result<Json>[src]
impl ConvertTo<Json> for Time[src]
fn convert(&self, ctx: &mut EvalContext) -> Result<Json>[src]
impl ConvertTo<Json> for Duration[src]
fn convert(&self, _: &mut EvalContext) -> Result<Json>[src]
impl ConvertTo<f64> for Json[src]
fn convert(&self, ctx: &mut EvalContext) -> Result<f64>[src]
Keep compatible with TiDB’s ConvertJSONToFloat function.
impl Debug for Json[src]
impl<'de> Deserialize<'de> for Json[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>, [src]
D: Deserializer<'de>,
impl Display for Json[src]
impl Eq for Json[src]
impl EvaluableRet for Json[src]
const EVAL_TYPE: EvalType[src]
type ChunkedType = ChunkedVecJson
fn cast_chunk_into_vector_value(vec: ChunkedVecJson) -> VectorValue[src]
impl From<Json> for ScalarValue[src]
fn from(s: Json) -> ScalarValue[src]
impl From<Json> for Datum[src]
impl FromStr for Json[src]
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>[src]
impl Ord for Json[src]
fn cmp(&self, right: &Json) -> Ordering[src]
#[must_use]pub fn max(self, other: Self) -> Self1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self1.50.0[src]
impl PartialEq<Json> for Json[src]
impl PartialOrd<Json> for Json[src]
fn partial_cmp(&self, right: &Json) -> Option<Ordering>[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'a> RawDatumDecoder<Json> for &'a [u8][src]
impl ToInt for Json[src]
fn to_int(&self, ctx: &mut EvalContext, tp: FieldTypeTp) -> Result<i64>[src]
fn to_uint(&self, ctx: &mut EvalContext, tp: FieldTypeTp) -> Result<u64>[src]
impl ToString for Json[src]
impl VectorValueExt<Json> for VectorValue[src]
Auto Trait Implementations
impl RefUnwindSafe for Json
impl Send for Json
impl Sync for Json
impl Unpin for Json
impl UnwindSafe for Json
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> ConvertTo<NotNan<f64>> for T where
T: ConvertTo<f64> + EvaluableRet, [src]
T: ConvertTo<f64> + EvaluableRet,
impl<T> ConvertTo<String> for T where
T: ToString + EvaluableRet, [src]
T: ToString + EvaluableRet,
impl<T> ConvertTo<Vec<u8, Global>> for T where
T: ToString + EvaluableRet, [src]
T: ToString + EvaluableRet,
impl<T> ConvertTo<i64> for T where
T: ToInt, [src]
T: ToInt,
impl<T> ConvertTo<u64> for T where
T: ToInt, [src]
T: ToInt,
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>, [src]
T: for<'de> Deserialize<'de>,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized, [src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool[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>,