pub enum PublicValue {
}Expand description
Represents a value in SurrealDB
This enum contains all possible value types that can be stored in SurrealDB. Each variant corresponds to a different data type supported by the database.
Variants§
None
Represents the absence of a value
Null
Represents a null value
Bool(bool)
A boolean value (true or false)
Number(Number)
A numeric value (integer, float, or decimal)
String(String)
A string value
Bytes(Bytes)
Binary data
Duration(Duration)
A duration value representing a time span
Datetime(Datetime)
A datetime value representing a point in time
Uuid(Uuid)
A UUID value
Geometry(Geometry)
A geometric value (point, line, polygon, etc.)
Table(Table)
A table value
RecordId(RecordId)
A record identifier
File(File)
A file reference
Range(Box<Range>)
A range of values
Regex(Regex)
A regular expression
Array(Array)
An array of values
Object(Object)
An object containing key-value pairs
Set(Set)
A set of values
Implementations§
Source§impl Value
impl Value
Sourcepub fn from_number(value: Number) -> Value
pub fn from_number(value: Number) -> Value
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn into_number(self) -> Result<Number, Error>
pub fn into_number(self) -> Result<Number, Error>
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Source§impl Value
impl Value
Source§impl Value
impl Value
Sourcepub fn into_float(self) -> Result<f64, Error>
pub fn into_float(self) -> Result<f64, Error>
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Source§impl Value
impl Value
Source§impl Value
impl Value
Sourcepub fn is_decimal(&self) -> bool
pub fn is_decimal(&self) -> bool
Checks if this value can be converted to the given type
Returns true if the value can be converted to the type, false otherwise.
Source§impl Value
impl Value
Sourcepub fn from_decimal(value: Decimal) -> Value
pub fn from_decimal(value: Decimal) -> Value
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn into_decimal(self) -> Result<Decimal, Error>
pub fn into_decimal(self) -> Result<Decimal, Error>
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Sourcepub fn as_decimal(&self) -> Option<&Decimal>
pub fn as_decimal(&self) -> Option<&Decimal>
Returns a reference to the inner value if it matches the expected type.
Returns Some(&T) if the value is of the expected type, None otherwise.
Source§impl Value
impl Value
Sourcepub fn from_string(value: String) -> Value
pub fn from_string(value: String) -> Value
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn into_string(self) -> Result<String, Error>
pub fn into_string(self) -> Result<String, Error>
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Sourcepub fn is_duration(&self) -> bool
pub fn is_duration(&self) -> bool
Checks if this value can be converted to the given type
Returns true if the value can be converted to the type, false otherwise.
Source§impl Value
impl Value
Sourcepub fn from_duration(value: Duration) -> Value
pub fn from_duration(value: Duration) -> Value
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn into_duration(self) -> Result<Duration, Error>
pub fn into_duration(self) -> Result<Duration, Error>
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Sourcepub fn as_duration(&self) -> Option<&Duration>
pub fn as_duration(&self) -> Option<&Duration>
Returns a reference to the inner value if it matches the expected type.
Returns Some(&T) if the value is of the expected type, None otherwise.
Source§impl Value
impl Value
Sourcepub fn is_datetime(&self) -> bool
pub fn is_datetime(&self) -> bool
Checks if this value can be converted to the given type
Returns true if the value can be converted to the type, false otherwise.
Source§impl Value
impl Value
Sourcepub fn from_datetime(value: Datetime) -> Value
pub fn from_datetime(value: Datetime) -> Value
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn into_datetime(self) -> Result<Datetime, Error>
pub fn into_datetime(self) -> Result<Datetime, Error>
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Sourcepub fn as_datetime(&self) -> Option<&Datetime>
pub fn as_datetime(&self) -> Option<&Datetime>
Returns a reference to the inner value if it matches the expected type.
Returns Some(&T) if the value is of the expected type, None otherwise.
Source§impl Value
impl Value
Sourcepub fn from_array(value: Array) -> Value
pub fn from_array(value: Array) -> Value
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn into_array(self) -> Result<Array, Error>
pub fn into_array(self) -> Result<Array, Error>
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Sourcepub fn from_object(value: Object) -> Value
pub fn from_object(value: Object) -> Value
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn into_object(self) -> Result<Object, Error>
pub fn into_object(self) -> Result<Object, Error>
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Sourcepub fn is_geometry(&self) -> bool
pub fn is_geometry(&self) -> bool
Checks if this value can be converted to the given type
Returns true if the value can be converted to the type, false otherwise.
Source§impl Value
impl Value
Sourcepub fn from_geometry(value: Geometry) -> Value
pub fn from_geometry(value: Geometry) -> Value
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn into_geometry(self) -> Result<Geometry, Error>
pub fn into_geometry(self) -> Result<Geometry, Error>
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Sourcepub fn as_geometry(&self) -> Option<&Geometry>
pub fn as_geometry(&self) -> Option<&Geometry>
Returns a reference to the inner value if it matches the expected type.
Returns Some(&T) if the value is of the expected type, None otherwise.
Source§impl Value
impl Value
Sourcepub fn from_bytes(value: Bytes) -> Value
pub fn from_bytes(value: Bytes) -> Value
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn into_bytes(self) -> Result<Bytes, Error>
pub fn into_bytes(self) -> Result<Bytes, Error>
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Sourcepub fn from_table(value: Table) -> Value
pub fn from_table(value: Table) -> Value
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn into_table(self) -> Result<Table, Error>
pub fn into_table(self) -> Result<Table, Error>
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Sourcepub fn from_record(value: RecordId) -> Value
pub fn from_record(value: RecordId) -> Value
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn into_record(self) -> Result<RecordId, Error>
pub fn into_record(self) -> Result<RecordId, Error>
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Sourcepub fn from_range(value: Range) -> Value
pub fn from_range(value: Range) -> Value
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn into_range(self) -> Result<Range, Error>
pub fn into_range(self) -> Result<Range, Error>
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Sourcepub fn is_vec<T>(&self) -> boolwhere
T: SurrealValue,
pub fn is_vec<T>(&self) -> boolwhere
T: SurrealValue,
Checks if this value can be converted to the given type
Returns true if the value can be converted to the type, false otherwise.
Source§impl Value
impl Value
Sourcepub fn from_vec<T>(value: Vec<T>) -> Valuewhere
T: SurrealValue,
pub fn from_vec<T>(value: Vec<T>) -> Valuewhere
T: SurrealValue,
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn is_option<T>(&self) -> boolwhere
T: SurrealValue,
pub fn is_option<T>(&self) -> boolwhere
T: SurrealValue,
Checks if this value can be converted to the given type
Returns true if the value can be converted to the type, false otherwise.
Source§impl Value
impl Value
Sourcepub fn from_option<T>(value: Option<T>) -> Valuewhere
T: SurrealValue,
pub fn from_option<T>(value: Option<T>) -> Valuewhere
T: SurrealValue,
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn into_option<T>(self) -> Result<Option<T>, Error>where
T: SurrealValue,
pub fn into_option<T>(self) -> Result<Option<T>, Error>where
T: SurrealValue,
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Sourcepub fn from_btreemap<V>(value: BTreeMap<String, V>) -> Valuewhere
V: SurrealValue,
pub fn from_btreemap<V>(value: BTreeMap<String, V>) -> Valuewhere
V: SurrealValue,
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn into_btreemap<V>(self) -> Result<BTreeMap<String, V>, Error>where
V: SurrealValue,
pub fn into_btreemap<V>(self) -> Result<BTreeMap<String, V>, Error>where
V: SurrealValue,
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Sourcepub fn from_hashmap<V>(value: HashMap<String, V>) -> Valuewhere
V: SurrealValue,
pub fn from_hashmap<V>(value: HashMap<String, V>) -> Valuewhere
V: SurrealValue,
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn into_hashmap<V>(self) -> Result<HashMap<String, V>, Error>where
V: SurrealValue,
pub fn into_hashmap<V>(self) -> Result<HashMap<String, V>, Error>where
V: SurrealValue,
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Sourcepub fn from_point(value: Point) -> Value
pub fn from_point(value: Point) -> Value
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn into_point(self) -> Result<Point, Error>
pub fn into_point(self) -> Result<Point, Error>
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Sourcepub fn from_line(value: LineString) -> Value
pub fn from_line(value: LineString) -> Value
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn into_line(self) -> Result<LineString, Error>
pub fn into_line(self) -> Result<LineString, Error>
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Sourcepub fn as_line(&self) -> Option<&LineString>
pub fn as_line(&self) -> Option<&LineString>
Returns a reference to the inner value if it matches the expected type.
Returns Some(&T) if the value is of the expected type, None otherwise.
Source§impl Value
impl Value
Sourcepub fn is_line_and(&self, callback: impl FnOnce(&LineString) -> bool) -> bool
pub fn is_line_and(&self, callback: impl FnOnce(&LineString) -> bool) -> bool
Checks if this value can be converted to the given type
Returns true if the value can be converted to the type, false otherwise.
Source§impl Value
impl Value
Sourcepub fn is_polygon(&self) -> bool
pub fn is_polygon(&self) -> bool
Checks if this value can be converted to the given type
Returns true if the value can be converted to the type, false otherwise.
Source§impl Value
impl Value
Sourcepub fn from_polygon(value: Polygon) -> Value
pub fn from_polygon(value: Polygon) -> Value
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn into_polygon(self) -> Result<Polygon, Error>
pub fn into_polygon(self) -> Result<Polygon, Error>
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Sourcepub fn as_polygon(&self) -> Option<&Polygon>
pub fn as_polygon(&self) -> Option<&Polygon>
Returns a reference to the inner value if it matches the expected type.
Returns Some(&T) if the value is of the expected type, None otherwise.
Source§impl Value
impl Value
Sourcepub fn is_multipoint(&self) -> bool
pub fn is_multipoint(&self) -> bool
Checks if this value can be converted to the given type
Returns true if the value can be converted to the type, false otherwise.
Source§impl Value
impl Value
Sourcepub fn from_multipoint(value: MultiPoint) -> Value
pub fn from_multipoint(value: MultiPoint) -> Value
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn into_multipoint(self) -> Result<MultiPoint, Error>
pub fn into_multipoint(self) -> Result<MultiPoint, Error>
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Sourcepub fn as_multipoint(&self) -> Option<&MultiPoint>
pub fn as_multipoint(&self) -> Option<&MultiPoint>
Returns a reference to the inner value if it matches the expected type.
Returns Some(&T) if the value is of the expected type, None otherwise.
Source§impl Value
impl Value
Sourcepub fn is_multipoint_and(
&self,
callback: impl FnOnce(&MultiPoint) -> bool,
) -> bool
pub fn is_multipoint_and( &self, callback: impl FnOnce(&MultiPoint) -> bool, ) -> bool
Checks if this value can be converted to the given type
Returns true if the value can be converted to the type, false otherwise.
Source§impl Value
impl Value
Sourcepub fn is_multiline(&self) -> bool
pub fn is_multiline(&self) -> bool
Checks if this value can be converted to the given type
Returns true if the value can be converted to the type, false otherwise.
Source§impl Value
impl Value
Sourcepub fn from_multiline(value: MultiLineString) -> Value
pub fn from_multiline(value: MultiLineString) -> Value
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn into_multiline(self) -> Result<MultiLineString, Error>
pub fn into_multiline(self) -> Result<MultiLineString, Error>
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Sourcepub fn as_multiline(&self) -> Option<&MultiLineString>
pub fn as_multiline(&self) -> Option<&MultiLineString>
Returns a reference to the inner value if it matches the expected type.
Returns Some(&T) if the value is of the expected type, None otherwise.
Source§impl Value
impl Value
Sourcepub fn is_multiline_and(
&self,
callback: impl FnOnce(&MultiLineString) -> bool,
) -> bool
pub fn is_multiline_and( &self, callback: impl FnOnce(&MultiLineString) -> bool, ) -> bool
Checks if this value can be converted to the given type
Returns true if the value can be converted to the type, false otherwise.
Source§impl Value
impl Value
Sourcepub fn is_multipolygon(&self) -> bool
pub fn is_multipolygon(&self) -> bool
Checks if this value can be converted to the given type
Returns true if the value can be converted to the type, false otherwise.
Source§impl Value
impl Value
Sourcepub fn from_multipolygon(value: MultiPolygon) -> Value
pub fn from_multipolygon(value: MultiPolygon) -> Value
Converts the given value into a Value
Source§impl Value
impl Value
Sourcepub fn into_multipolygon(self) -> Result<MultiPolygon, Error>
pub fn into_multipolygon(self) -> Result<MultiPolygon, Error>
Attempts to convert a SurrealDB value into the given type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Source§impl Value
impl Value
Sourcepub fn as_multipolygon(&self) -> Option<&MultiPolygon>
pub fn as_multipolygon(&self) -> Option<&MultiPolygon>
Returns a reference to the inner value if it matches the expected type.
Returns Some(&T) if the value is of the expected type, None otherwise.
Source§impl Value
impl Value
Sourcepub fn is_multipolygon_and(
&self,
callback: impl FnOnce(&MultiPolygon) -> bool,
) -> bool
pub fn is_multipolygon_and( &self, callback: impl FnOnce(&MultiPolygon) -> bool, ) -> bool
Checks if this value can be converted to the given type
Returns true if the value can be converted to the type, false otherwise.
Source§impl Value
impl Value
Source§impl Value
impl Value
Source§impl Value
impl Value
Source§impl Value
impl Value
Sourcepub fn from_isize(value: isize) -> Value
pub fn from_isize(value: isize) -> Value
Converts the given value into a Value
Sourcepub fn into_isize(self) -> Result<isize, Error>
pub fn into_isize(self) -> Result<isize, Error>
Attempts to convert a SurrealDB value into the given type
Source§impl Value
impl Value
Source§impl Value
impl Value
Source§impl Value
impl Value
Source§impl Value
impl Value
Source§impl Value
impl Value
Sourcepub fn from_usize(value: usize) -> Value
pub fn from_usize(value: usize) -> Value
Converts the given value into a Value
Sourcepub fn into_usize(self) -> Result<usize, Error>
pub fn into_usize(self) -> Result<usize, Error>
Attempts to convert a SurrealDB value into the given type
Source§impl Value
impl Value
Source§impl Value
impl Value
Sourcepub fn into_json_value(self) -> Value
pub fn into_json_value(self) -> Value
Converts the value into a json representation of the value. Returns None if there are non serializable values present in the value.
Source§impl Value
impl Value
Sourcepub fn kind(&self) -> Kind
pub fn kind(&self) -> Kind
Returns the kind of this value
This method maps each value variant to its corresponding Kind.
Sourcepub fn first(&self) -> Option<Value>
pub fn first(&self) -> Option<Value>
Returns the first value in the array.
Returns None if the value is not an array or the array is empty.
Sourcepub fn is_nullish(&self) -> bool
pub fn is_nullish(&self) -> bool
Check if this Value is NONE or NULL
Sourcepub fn get<Idx>(&self, index: Idx) -> &Value
pub fn get<Idx>(&self, index: Idx) -> &Value
Accesses the value found at a certain field if an object, and a certain index if an array. Will not err if no value is found at this point, instead returning a Value::None. If an Option<&Value> is desired, the .into_option() method can be used to perform the conversion.
Sourcepub fn remove<Idx>(&mut self, index: Idx) -> Value
pub fn remove<Idx>(&mut self, index: Idx) -> Value
Removes the value at the given index.
Returns Some(Value) if the value was removed, None if the value was not found.
Sourcepub fn is<T>(&self) -> boolwhere
T: SurrealValue,
pub fn is<T>(&self) -> boolwhere
T: SurrealValue,
Checks if this value is of the specified type
Returns true if the value can be converted to the given type T.
Sourcepub fn into_t<T>(self) -> Result<T, Error>where
T: SurrealValue,
pub fn into_t<T>(self) -> Result<T, Error>where
T: SurrealValue,
Converts this value to the specified type
Returns Ok(T) if the conversion is successful, Err(Error) otherwise.
Sourcepub fn from_t<T>(value: T) -> Valuewhere
T: SurrealValue,
pub fn from_t<T>(value: T) -> Valuewhere
T: SurrealValue,
Creates a value from the specified type
Converts the given value of type T into a Value.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Value, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Value, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl FromFlatbuffers for Value
impl FromFlatbuffers for Value
Source§impl FromIterator<Value> for Value
impl FromIterator<Value> for Value
Source§impl Ord for Value
impl Ord for Value
Source§impl PartialEq<Value> for RecordIdKey
impl PartialEq<Value> for RecordIdKey
Source§impl PartialOrd for Value
impl PartialOrd for Value
Source§impl Serialize for Value
impl Serialize for Value
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl SurrealValue for Value
impl SurrealValue for Value
Source§fn into_value(self) -> Value
fn into_value(self) -> Value
Source§impl ToFlatbuffers for Value
impl ToFlatbuffers for Value
impl Eq for Value
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl !Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
Blanket Implementations§
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,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more