pub enum Value {
Show 52 variants
Null,
Integer(i64),
UnsignedInteger(u64),
Float(f64),
Text(Arc<str>),
Blob(Vec<u8>),
Boolean(bool),
Timestamp(i64),
Duration(i64),
IpAddr(IpAddr),
MacAddr([u8; 6]),
Vector(Vec<f32>),
Json(Vec<u8>),
Uuid([u8; 16]),
NodeRef(String),
EdgeRef(String),
VectorRef(String, u64),
RowRef(String, u64),
Color([u8; 3]),
Email(String),
Url(String),
Phone(u64),
Semver(u32),
Cidr(u32, u8),
Date(i32),
Time(u32),
Decimal(i64),
EnumValue(u8),
Array(Vec<Value>),
TimestampMs(i64),
Ipv4(u32),
Ipv6([u8; 16]),
Subnet(u32, u32),
Port(u16),
Latitude(i32),
Longitude(i32),
GeoPoint(i32, i32),
Country2([u8; 2]),
Country3([u8; 3]),
Lang2([u8; 2]),
Lang5([u8; 5]),
Currency([u8; 3]),
AssetCode(String),
Money {
asset_code: String,
minor_units: i64,
scale: u8,
},
ColorAlpha([u8; 4]),
BigInt(i64),
KeyRef(String, String),
DocRef(String, u64),
TableRef(String),
PageRef(u32),
Secret(Vec<u8>),
Password(String),
}Expand description
A typed value that can be stored in RedDB
Variants§
Null
Null value
Integer(i64)
Signed 64-bit integer
UnsignedInteger(u64)
Unsigned 64-bit integer
Float(f64)
64-bit floating point
Text(Arc<str>)
UTF-8 text
Blob(Vec<u8>)
Binary data
Boolean(bool)
Boolean
Timestamp(i64)
Unix timestamp (seconds)
Duration(i64)
Duration in milliseconds
IpAddr(IpAddr)
IP address (v4 or v6)
MacAddr([u8; 6])
MAC address
Vector(Vec<f32>)
Float vector for similarity search
Json(Vec<u8>)
JSON-like structured data (stored as bytes)
Uuid([u8; 16])
UUID
NodeRef(String)
Graph node reference (node ID string)
EdgeRef(String)
Graph edge reference (edge ID string)
VectorRef(String, u64)
Vector store reference (collection, vector ID)
RowRef(String, u64)
Table row reference (table name, row ID)
Color([u8; 3])
RGB color
Email(String)
Email (stored lowercase, validated)
Url(String)
URL (validated)
Phone(u64)
Phone as digits (e.g., +5511999 -> 5511999u64)
Semver(u32)
Semantic version packed as u32
Cidr(u32, u8)
CIDR (ip as u32, prefix as u8)
Date(i32)
Date as days since Unix epoch
Time(u32)
Time as milliseconds since midnight
Decimal(i64)
Fixed-point decimal (value * 10^precision)
EnumValue(u8)
Enum variant index
Array(Vec<Value>)
Homogeneous array
TimestampMs(i64)
Timestamp in milliseconds since epoch
Ipv4(u32)
IPv4 as u32
Ipv6([u8; 16])
IPv6 as 16 bytes
Subnet(u32, u32)
Subnet: ip(u32) + mask(u32)
Port(u16)
Port number
Latitude(i32)
Latitude in microdegrees (degrees * 1_000_000)
Longitude(i32)
Longitude in microdegrees
GeoPoint(i32, i32)
GeoPoint (lat, lon) in microdegrees
Country2([u8; 2])
ISO country code 2-letter
Country3([u8; 3])
ISO country code 3-letter
Lang2([u8; 2])
Language code 2-letter
Lang5([u8; 5])
Language tag 5-char (e.g., “pt-BR”)
Currency([u8; 3])
Currency code 3-letter
AssetCode(String)
General asset code, normalized uppercase text
Money
Monetary amount stored as integer minor units plus explicit scale and asset code
ColorAlpha([u8; 4])
RGBA color with alpha
BigInt(i64)
Big integer (same as Integer but with distinct type for schema clarity)
KeyRef(String, String)
Reference to a KV pair (collection, key)
DocRef(String, u64)
Reference to a document (collection, entity_id)
TableRef(String)
Reference to a table/collection by name
PageRef(u32)
Reference to a physical storage page (page_id)
Secret(Vec<u8>)
Encrypted secret (AES-256-GCM ciphertext bytes: nonce + ciphertext + tag)
Password(String)
Argon2id password hash string
Implementations§
Source§impl Value
impl Value
Sourcepub fn text(s: impl Into<Arc<str>>) -> Value
pub fn text(s: impl Into<Arc<str>>) -> Value
Construct a Value::Text from anything that can produce an
Arc<str> — String, &str, or an existing Arc<str>.
The drop-in migration helper for the old
Value::Text(String) constructor style.
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
Serialize value to bytes.
Delegates to super::value_codec::encode — the registry
module owns every variant’s byte layout. See value_codec
for the full format spec.
Sourcepub fn from_bytes(data: &[u8]) -> Result<(Value, usize), ValueError>
pub fn from_bytes(data: &[u8]) -> Result<(Value, usize), ValueError>
Deserialize value from bytes.
Delegates to super::value_codec::decode.
Sourcepub fn as_integer(&self) -> Option<i64>
pub fn as_integer(&self) -> Option<i64>
Try to convert to i64
Sourcepub fn as_boolean(&self) -> Option<bool>
pub fn as_boolean(&self) -> Option<bool>
Try to convert to bool
Sourcepub fn as_ip_addr(&self) -> Option<IpAddr>
pub fn as_ip_addr(&self) -> Option<IpAddr>
Try to convert to IpAddr
Sourcepub fn display_string(&self) -> String
pub fn display_string(&self) -> String
Human-readable display string for rich types
Sourcepub fn plain_text(&self) -> String
pub fn plain_text(&self) -> String
Plain text coercion for string-producing SQL operators.
Unlike Display, this does not render Text as a SQL literal.
Trait Implementations§
Source§impl Hash for Value
Manual Hash impl for Value.
impl Hash for Value
Manual Hash impl for Value.
- Floats: use
f64.to_bits()so the invarianta == b → hash(a) == hash(b)holds. - Arrays / nested values: hash each element recursively.
- All other variants: delegate to the byte-level representation.
impl Eq for Value
Manual Eq impl: consistent with the manual Hash impl below.
Float NaN is treated as equal to itself (bit-level equality) so that
Value can be used in HashSet<Value> for IN-list optimizations.
This diverges from IEEE 754 but is safe for SQL query evaluation.
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> 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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request