Struct tidb_query_datatype::codec::mysql::json::JsonRef [−][src]
Represents a reference of JSON value aiming to reduce memory copy.
Fields
type_code: JsonType
value: &'a [u8]
Implementations
impl<'a> JsonRef<'a>
[src]
pub fn array_get_elem(&self, idx: usize) -> Result<JsonRef<'a>>
[src]
Gets the ith element in JsonRef
See arrayGetElem()
in TiDB json/binary.go
pub fn object_get_key(&self, i: usize) -> &'a [u8]
[src]
Return the i
th key in current Object json
See arrayGetElem()
in TiDB json/binary.go
pub fn object_get_val(&self, i: usize) -> Result<JsonRef<'a>>
[src]
Returns the JsonRef of i
th value in current Object json
See arrayGetElem()
in TiDB json/binary.go
pub fn object_search_key(&self, key: &[u8]) -> Option<usize>
[src]
Searches the value index by the give key
in Object.
See objectSearchKey()
in TiDB json/binary_function.go
pub fn val_entry_get(&self, val_entry_off: usize) -> Result<JsonRef<'a>>
[src]
Gets the value (JsonRef) by the given offset of the value entry
See arrayGetElem()
in TiDB json/binary.go
pub(super) fn as_ptr(&self) -> *const u8
[src]
Returns a raw pointer to the underlying values buffer.
pub(super) fn as_literal(&self) -> Result<u8>
[src]
Returns the literal value of JSON document
pub fn binary_len(&self) -> usize
[src]
Returns the encoding binary length of self
impl<'a> JsonRef<'a>
[src]
impl<'a> JsonRef<'a>
[src]
fn encoded_len(&self) -> usize
[src]
impl<'a> JsonRef<'a>
[src]
impl<'a> JsonRef<'a>
[src]
pub fn extract(&self, path_expr_list: &[PathExpression]) -> Result<Option<Json>>
[src]
extract
receives several path expressions as arguments, matches them in j, and returns
the target JSON matched any path expressions, which may be autowrapped as an array.
If there is no any expression matched, it returns None.
See Extract()
in TiDB json.binary_function.go
impl<'a> JsonRef<'a>
[src]
pub fn keys(&self, path_expr_list: &[PathExpression]) -> Result<Option<Json>>
[src]
Evaluates a (possibly empty) list of values and returns a JSON array containing those values specified by path_expr_list
impl<'a> JsonRef<'a>
[src]
fn len(&self) -> i64
[src]
pub fn json_length(
&self,
path_expr_list: &[PathExpression]
) -> Result<Option<i64>>
[src]
&self,
path_expr_list: &[PathExpression]
) -> Result<Option<i64>>
json_length
is the implementation for JSON_LENGTH in mysql
https://dev.mysql.com/doc/refman/5.7/en/json-attribute-functions.html#function_json-length
impl<'a> JsonRef<'a>
[src]
pub fn modify(
&self,
path_expr_list: &[PathExpression],
values: Vec<Json>,
mt: ModifyType
) -> Result<Json>
[src]
&self,
path_expr_list: &[PathExpression],
values: Vec<Json>,
mt: ModifyType
) -> Result<Json>
Modifies a Json object by insert, replace or set. All path expressions cannot contain * or ** wildcard. If any error occurs, the input won’t be changed.
See Modify()
in TiDB json/binary_function.go
impl<'a> JsonRef<'a>
[src]
pub fn remove(&self, path_expr_list: &[PathExpression]) -> Result<Json>
[src]
Removes elements from Json, All path expressions cannot contain * or ** wildcard. If any error occurs, the input won’t be changed.
impl<'a> JsonRef<'a>
[src]
pub fn json_type(&self) -> &'static [u8]
[src]
json_type
is the implementation for
https://dev.mysql.com/doc/refman/5.7/en/json-attribute-functions.html#function_json-type
impl<'a> JsonRef<'a>
[src]
pub fn unquote(&self) -> Result<String>
[src]
unquote
recognizes the escape sequences shown in:
https://dev.mysql.com/doc/refman/5.7/en/json-modification-functions.html
json-unquote-character-escape-sequences
See Unquote()
in TiDB json/binary_function.go
impl<'a> JsonRef<'a>
[src]
pub fn new(type_code: JsonType, value: &[u8]) -> JsonRef<'_>
[src]
pub fn to_owned(&self) -> Json
[src]
Returns an owned Json via copying
pub fn get_type(&self) -> JsonType
[src]
Returns the JSON type
pub fn value(&self) -> &'a [u8]
[src]
Returns the underlying value slice
pub(crate) fn get_u64(&self) -> u64
[src]
pub(crate) fn get_i64(&self) -> i64
[src]
pub(crate) fn get_double(&self) -> f64
[src]
pub(crate) fn get_elem_count(&self) -> usize
[src]
pub(crate) fn get_literal(&self) -> Option<bool>
[src]
pub(crate) fn get_str_bytes(&self) -> Result<&'a [u8]>
[src]
pub(crate) fn get_str(&self) -> Result<&'a str>
[src]
pub(crate) fn is_zero(&self) -> bool
[src]
Trait Implementations
impl<'a> AsMySQLBool for JsonRef<'a>
[src]
fn as_mysql_bool(&self, _context: &mut EvalContext) -> Result<bool>
[src]
impl<'a> ChunkRef<'a, JsonRef<'a>> for &'a ChunkedVecJson
[src]
fn get_option_ref(self, idx: usize) -> Option<JsonRef<'a>>
[src]
fn get_bit_vec(self) -> &'a BitVec
[src]
fn phantom_data(self) -> Option<JsonRef<'a>>
[src]
impl<'a> Clone 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<NotNan<f64>> for JsonRef<'a>
[src]
fn convert(&self, ctx: &mut EvalContext) -> Result<Real>
[src]
impl<'a> ConvertTo<String> for JsonRef<'a>
[src]
fn convert(&self, _: &mut EvalContext) -> Result<String>
[src]
impl<'a> ConvertTo<Vec<u8, Global>> for JsonRef<'a>
[src]
fn convert(&self, _: &mut EvalContext) -> Result<Bytes>
[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> Copy for JsonRef<'a>
[src]
impl<'a> Debug for JsonRef<'a>
[src]
impl<'a> Eq for JsonRef<'a>
[src]
impl<'a> EvaluableRef<'a> for JsonRef<'a>
[src]
const EVAL_TYPE: EvalType
[src]
type EvaluableType = Json
type ChunkedType = &'a ChunkedVecJson
fn borrow_scalar_value(v: &'a ScalarValue) -> Option<Self>
[src]
fn borrow_scalar_value_ref(v: ScalarValueRef<'a>) -> Option<Self>
[src]
fn borrow_vector_value(v: &VectorValue) -> &ChunkedVecJson
[src]
fn into_owned_value(self) -> Self::EvaluableType
[src]
fn from_owned_value(value: &'a Json) -> Self
[src]
impl<'a> Ord for JsonRef<'a>
[src]
fn cmp(&self, right: &JsonRef<'_>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<'a> PartialEq<JsonRef<'a>> for JsonRef<'a>
[src]
fn eq(&self, right: &JsonRef<'_>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a> PartialOrd<JsonRef<'a>> for JsonRef<'a>
[src]
fn partial_cmp(&self, right: &JsonRef<'_>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a> Serialize for JsonRef<'a>
[src]
impl<'a> ToInt for JsonRef<'a>
[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<'a> ToString for JsonRef<'a>
[src]
fn to_string(&self) -> String
[src]
This function is a simple combination and rewrite of serde_json’s to_writer_pretty
impl<'a> UnsafeRefInto<JsonRef<'static>> for JsonRef<'a>
[src]
unsafe fn unsafe_into(self) -> JsonRef<'static>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for JsonRef<'a>
impl<'a> Send for JsonRef<'a>
impl<'a> Sync for JsonRef<'a>
impl<'a> Unpin for JsonRef<'a>
impl<'a> UnwindSafe for JsonRef<'a>
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<i64> for T where
T: ToInt,
[src]
T: ToInt,
impl<T> ConvertTo<u64> for T where
T: ToInt,
[src]
T: ToInt,
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, 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>,