pub struct VibeTableKeyVal { /* private fields */ }Expand description
Key-value row returned by advanced database APIs. Database row representation for a key-value item.
Applications usually work with VibeKvStore; this
row type is exposed for advanced database integrations.
Implementations§
Source§impl VibeTableKeyVal
impl VibeTableKeyVal
Sourcepub fn new(user_id: &str, key: &str, value: VibeKvValue) -> Self
pub fn new(user_id: &str, key: &str, value: VibeKvValue) -> Self
Build a row using the default bucket and no TTL.
§Returns
A VibeTableKeyVal row targeting the default bucket.
Sourcepub fn new_in_bucket(
user_id: &str,
bucket: &str,
key: &str,
value: VibeKvValue,
expires_at_ms: i64,
) -> Self
pub fn new_in_bucket( user_id: &str, bucket: &str, key: &str, value: VibeKvValue, expires_at_ms: i64, ) -> Self
Build a row with explicit bucket and optional expires_at_ms
(0 means no expiry).
§Returns
A VibeTableKeyVal row targeting the specified bucket.
Sourcepub fn new_with_str(user_id: &str, key: &str, val: &str) -> Self
pub fn new_with_str(user_id: &str, key: &str, val: &str) -> Self
Sourcepub fn new_with_bool(user_id: &str, key: &str, val: bool) -> Self
pub fn new_with_bool(user_id: &str, key: &str, val: bool) -> Self
Sourcepub fn new_with_i32(user_id: &str, key: &str, val: i32) -> Self
pub fn new_with_i32(user_id: &str, key: &str, val: i32) -> Self
Sourcepub fn expires_at_ms(&self) -> i64
pub fn expires_at_ms(&self) -> i64
Sourcepub fn is_expired(&self, now_ms: i64) -> bool
pub fn is_expired(&self, now_ms: i64) -> bool
Checks whether the row is expired at now_ms.
§Returns
true when the row has an expiry timestamp and now_ms is at or past it.
Sourcepub fn value(&self) -> Option<VibeKvValue>
pub fn value(&self) -> Option<VibeKvValue>
Converts the row payload back into a high-level value.
§Returns
Some(VibeKvValue) for known value types, otherwise None.
Sourcepub fn get_value_str(&self) -> Option<&str>
pub fn get_value_str(&self) -> Option<&str>
Returns the row payload as a string if its type is string.
§Returns
Some(&str) for string rows, otherwise None.
Sourcepub fn get_value_bool(&self) -> Option<bool>
pub fn get_value_bool(&self) -> Option<bool>
Returns the row payload as a boolean if its type is boolean.
§Returns
Some(bool) for boolean rows, otherwise None.
Sourcepub fn get_value_i32(&self) -> Option<i32>
pub fn get_value_i32(&self) -> Option<i32>
Returns the row payload as an i32 if its type is i32.
§Returns
Some(i32) for i32 rows, otherwise None.
Trait Implementations§
Source§impl Clone for VibeTableKeyVal
impl Clone for VibeTableKeyVal
Source§fn clone(&self) -> VibeTableKeyVal
fn clone(&self) -> VibeTableKeyVal
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VibeTableKeyVal
impl Debug for VibeTableKeyVal
Source§impl<'de> Deserialize<'de> for VibeTableKeyVal
impl<'de> Deserialize<'de> for VibeTableKeyVal
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for VibeTableKeyVal
impl PartialEq for VibeTableKeyVal
Source§fn eq(&self, other: &VibeTableKeyVal) -> bool
fn eq(&self, other: &VibeTableKeyVal) -> bool
self and other values to be equal, and is used by ==.Source§impl<__DB: Backend, __ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11), __DB> for VibeTableKeyVal
impl<__DB: Backend, __ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11), __DB> for VibeTableKeyVal
Source§impl<__DB: Backend> Selectable<__DB> for VibeTableKeyVal
impl<__DB: Backend> Selectable<__DB> for VibeTableKeyVal
Source§type SelectExpression = (user_id, bucket, key, value_type, value_str, value_bool, value_i32, value_i64, value_f64, value_bytes, value_json, expires_at_ms)
type SelectExpression = (user_id, bucket, key, value_type, value_str, value_bool, value_i32, value_i64, value_f64, value_bytes, value_json, expires_at_ms)
Source§fn construct_selection() -> Self::SelectExpression
fn construct_selection() -> Self::SelectExpression
Source§impl Serialize for VibeTableKeyVal
impl Serialize for VibeTableKeyVal
impl StructuralPartialEq for VibeTableKeyVal
Auto Trait Implementations§
impl Freeze for VibeTableKeyVal
impl RefUnwindSafe for VibeTableKeyVal
impl Send for VibeTableKeyVal
impl Sync for VibeTableKeyVal
impl Unpin for VibeTableKeyVal
impl UnsafeUnpin for VibeTableKeyVal
impl UnwindSafe for VibeTableKeyVal
Blanket Implementations§
Source§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> Self::Output
fn aggregate_filter<P>(self, f: P) -> Self::Output
Source§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self to an expression for Diesel’s query builder. Read moreSource§impl<T, DB> SelectableHelper<DB> for Twhere
T: Selectable<DB>,
DB: Backend,
impl<T, DB> SelectableHelper<DB> for Twhere
T: Selectable<DB>,
DB: Backend,
Source§fn as_select() -> SelectBy<T, DB>
fn as_select() -> SelectBy<T, DB>
Selectable implementation. Read moreSource§fn as_returning() -> SelectBy<Self, DB>
fn as_returning() -> SelectBy<Self, DB>
as_select that can be used with returning clauses