pub enum CursorValue {
String(String),
Int(i64),
Float(f64),
Uuid(String),
}Expand description
The value a cursor points at.
Serialized as a bare JSON number or string, except CursorValue::Uuid,
which is serialized as {"uuid": "..."} so that the variant survives an
encode/decode round trip and PostgreSQL still receives the ::uuid cast.
Cursors issued by older versions (a bare string for UUIDs) decode as
CursorValue::String.
Variants§
String(String)
Int(i64)
Float(f64)
Uuid(String)
UUID value stored as string, will be cast to UUID in SQL
Implementations§
Source§impl CursorValue
impl CursorValue
Sourcepub fn from_json(value: &Value, template: Option<&CursorValue>) -> Option<Self>
pub fn from_json(value: &Value, template: Option<&CursorValue>) -> Option<Self>
Convert a JSON value, typically one field of a serialized row, into a cursor value.
template is an existing cursor value on the same field; when given, string
values keep its String/Uuid variant and integers keep a Float variant.
Without a template, strings shaped like a UUID become CursorValue::Uuid.
Booleans, nulls, arrays, and objects cannot be cursor values.
Trait Implementations§
Source§impl Clone for CursorValue
impl Clone for CursorValue
Source§fn clone(&self) -> CursorValue
fn clone(&self) -> CursorValue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more