[−][src]Struct tarantool_module::index::Index
Implementations
impl Index
[src]
pub fn get<K>(&self, key: &K) -> Result<Option<Tuple>, Error> where
K: AsTuple,
[src]
K: AsTuple,
Get a tuple from index by the key.
Please note that this function works much more faster than select
key
- encoded key in MsgPack Array format ([part1, part2, ...]
).
Returns a tuple or None
if index is empty
pub fn select<K>(
&self,
iterator_type: IteratorType,
key: &K
) -> Result<IndexIterator, Error> where
K: AsTuple,
[src]
&self,
iterator_type: IteratorType,
key: &K
) -> Result<IndexIterator, Error> where
K: AsTuple,
Allocate and initialize iterator for index.
type
- iterator typekey
- encoded key in MsgPack Array format ([part1, part2, ...]
).
pub fn delete<K>(&mut self, key: &K) -> Result<Option<Tuple>, Error> where
K: AsTuple,
[src]
K: AsTuple,
Execute an DELETE request.
key
- encoded key in MsgPack Array format ([part1, part2, ...]
).
Returns an old tuple
See also: box.space[space_id].index[index_id]:delete(key)
pub fn update<K, Op>(
&mut self,
key: &K,
ops: &Vec<Op>
) -> Result<Option<Tuple>, Error> where
K: AsTuple,
Op: AsTuple,
[src]
&mut self,
key: &K,
ops: &Vec<Op>
) -> Result<Option<Tuple>, Error> where
K: AsTuple,
Op: AsTuple,
Execute an UPDATE request.
key
- encoded key in MsgPack Array format ([part1, part2, ...]
).ops
- encoded operations in MsgPack Arrat format, e.g.[['=', field_id, value], ['!', 2, 'xxx']]
Returns a new tuple.
See also: box.space[space_id].index[index_id]:update(key, ops)
, upsert
pub fn upsert<T, Op>(
&mut self,
value: &T,
ops: &Vec<Op>
) -> Result<Option<Tuple>, Error> where
T: AsTuple,
Op: AsTuple,
[src]
&mut self,
value: &T,
ops: &Vec<Op>
) -> Result<Option<Tuple>, Error> where
T: AsTuple,
Op: AsTuple,
Execute an UPSERT request.
value
- encoded tuple in MsgPack Array format ([field1, field2, ...]
)ops
- encoded operations in MsgPack Arrat format, e.g.[['=', field_id, value], ['!', 2, 'xxx']]
Returns a new tuple.
See also: box.space[space_id].index[index_id]:update(key, ops)
, update
pub fn len(&self) -> Result<usize, Error>
[src]
Return the number of elements in the index.
pub fn bsize(&self) -> Result<usize, Error>
[src]
Return the number of bytes used in memory by the index.
pub fn random(&self, seed: u32) -> Result<Option<Tuple>, Error>
[src]
Return a random tuple from the index (useful for statistical analysis).
rnd
- random seed
See also: box.space[space_id].index[index_id]:random(rnd)
pub fn min<K>(&self, key: &K) -> Result<Option<Tuple>, Error> where
K: AsTuple,
[src]
K: AsTuple,
Return a first (minimal) tuple matched the provided key.
key
- encoded key in MsgPack Array format ([part1, part2, ...]
).
Returns a tuple or None
if index is empty
pub fn max<K>(&self, key: &K) -> Result<Option<Tuple>, Error> where
K: AsTuple,
[src]
K: AsTuple,
Return a last (maximal) tuple matched the provided key.
key
- encoded key in MsgPack Array format ([part1, part2, ...]
).
Returns a tuple or None
if index is empty
pub fn count<K>(
&self,
iterator_type: IteratorType,
key: &K
) -> Result<usize, Error> where
K: AsTuple,
[src]
&self,
iterator_type: IteratorType,
key: &K
) -> Result<usize, Error> where
K: AsTuple,
Count the number of tuple matched the provided key.
type
- iterator typekey
- encoded key in MsgPack Array format ([part1, part2, ...]
).
pub fn extract_key(&self, tuple: Tuple) -> Tuple
[src]
Extract key from tuple according to key definition of given
index. Returned buffer is allocated on box_txn_alloc()
with
this key.
tuple
- tuple from which need to extract key.
Auto Trait Implementations
impl RefUnwindSafe for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnwindSafe for Index
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<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,