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][+]
impl<'a> ChunkRef<'a, JsonRef<'a>> for &'a ChunkedVecJson
[src][+]
impl<'a> Clone for JsonRef<'a>
[src][+]
impl<'a> ConvertTo<Decimal> for JsonRef<'a>
[src][+]
impl<'a> ConvertTo<NotNan<f64>> for JsonRef<'a>
[src][+]
impl<'a> ConvertTo<String> for JsonRef<'a>
[src][+]
impl<'a> ConvertTo<Vec<u8, Global>> for JsonRef<'a>
[src][+]
impl<'a> ConvertTo<f64> for JsonRef<'a>
[src][+]
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][+]
impl<'a> Ord for JsonRef<'a>
[src][+]
impl<'a> PartialEq<JsonRef<'a>> for JsonRef<'a>
[src][+]
impl<'a> PartialOrd<JsonRef<'a>> for JsonRef<'a>
[src][+]
impl<'a> Serialize for JsonRef<'a>
[src][+]
impl<'a> ToInt for JsonRef<'a>
[src][+]
impl<'a> ToString for JsonRef<'a>
[src][+]
impl<'a> UnsafeRefInto<JsonRef<'static>> for JsonRef<'a>
[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,
impl<V, W> ConvertFrom<W> for V where
W: ConvertTo<V>,
[src][+]
W: ConvertTo<V>,
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,
impl<T> From<T> for T
[src][+]
impl<T> Instrument for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> Pointable for T
[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,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src][+]
V: MultiLane<T>,