pub struct PartitionKey {
pub columns: Vec<(String, Value)>,
}Expand description
Partition key with multi-column support
Stores the partition key as a list of (column name, value) pairs. The order must match the schema’s partition key definition.
Fields§
§columns: Vec<(String, Value)>Column name and value pairs (in schema order)
Implementations§
Source§impl PartitionKey
impl PartitionKey
Sourcepub fn single(column: impl Into<String>, value: Value) -> Self
pub fn single(column: impl Into<String>, value: Value) -> Self
Create a partition key from a single column
Sourcepub fn to_bytes(&self, schema: &TableSchema) -> Result<Vec<u8>>
pub fn to_bytes(&self, schema: &TableSchema) -> Result<Vec<u8>>
Serialize partition key to bytes according to Cassandra’s on-disk encoding.
Single-component keys are written as raw value bytes.
Multi-component keys use [len][value][0x00] per component, including a
trailing 0x00 after the final component.
Sourcepub fn to_decorated_key(&self, schema: &TableSchema) -> Result<DecoratedKey>
pub fn to_decorated_key(&self, schema: &TableSchema) -> Result<DecoratedKey>
Convert to DecoratedKey (token + raw bytes)
Sourcepub fn from_bytes(data: &[u8], schema: &TableSchema) -> Result<Self>
pub fn from_bytes(data: &[u8], schema: &TableSchema) -> Result<Self>
Deserialize partition key from raw bytes (inverse of to_bytes)
Single-component keys are raw value bytes.
Multi-component keys use [len:u16 BE][value bytes][0x00] per component.
Trait Implementations§
Source§impl Clone for PartitionKey
impl Clone for PartitionKey
Source§fn clone(&self) -> PartitionKey
fn clone(&self) -> PartitionKey
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PartitionKey
impl Debug for PartitionKey
Source§impl<'de> Deserialize<'de> for PartitionKey
impl<'de> Deserialize<'de> for PartitionKey
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for PartitionKey
impl PartialEq for PartitionKey
Source§fn eq(&self, other: &PartitionKey) -> bool
fn eq(&self, other: &PartitionKey) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for PartitionKey
impl Serialize for PartitionKey
impl StructuralPartialEq for PartitionKey
Auto Trait Implementations§
impl Freeze for PartitionKey
impl RefUnwindSafe for PartitionKey
impl Send for PartitionKey
impl Sync for PartitionKey
impl Unpin for PartitionKey
impl UnsafeUnpin for PartitionKey
impl UnwindSafe for PartitionKey
Blanket Implementations§
impl<T> Allocation for T
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
Mutably borrows from an owned value. Read more