pub struct StringSchema { /* private fields */ }Expand description
Schema for Redis string values, defining how to parse and convert them.
Redis strings are simple key-value pairs. This schema defines what type the values should be parsed as (e.g., Int64 for counters, Utf8 for text).
§Example
ⓘ
use polars_redis::StringSchema;
use arrow::datatypes::DataType;
// For string counters
let schema = StringSchema::new(DataType::Int64)
.with_key(true)
.with_value_column_name("count");
// For text values
let schema = StringSchema::new(DataType::Utf8)
.with_key(true);§Output Schema
_key(optional): The Redis keyvalue: The parsed value (type depends on schema)_ttl(optional): TTL in seconds
Implementations§
Source§impl StringSchema
impl StringSchema
Sourcepub fn with_key_column_name(self, name: impl Into<String>) -> Self
pub fn with_key_column_name(self, name: impl Into<String>) -> Self
Set the name of the key column.
Sourcepub fn with_value_column_name(self, name: impl Into<String>) -> Self
pub fn with_value_column_name(self, name: impl Into<String>) -> Self
Set the name of the value column.
Sourcepub fn with_ttl_column_name(self, name: impl Into<String>) -> Self
pub fn with_ttl_column_name(self, name: impl Into<String>) -> Self
Set the name of the TTL column.
Sourcepub fn value_type(&self) -> &DataType
pub fn value_type(&self) -> &DataType
Get the value type.
Sourcepub fn include_key(&self) -> bool
pub fn include_key(&self) -> bool
Whether the key column is included.
Sourcepub fn key_column_name(&self) -> &str
pub fn key_column_name(&self) -> &str
Get the key column name.
Sourcepub fn value_column_name(&self) -> &str
pub fn value_column_name(&self) -> &str
Get the value column name.
Sourcepub fn include_ttl(&self) -> bool
pub fn include_ttl(&self) -> bool
Whether the TTL column is included.
Sourcepub fn ttl_column_name(&self) -> &str
pub fn ttl_column_name(&self) -> &str
Get the TTL column name.
Sourcepub fn to_arrow_schema(&self) -> Schema
pub fn to_arrow_schema(&self) -> Schema
Convert to Arrow Schema.
Trait Implementations§
Source§impl Clone for StringSchema
impl Clone for StringSchema
Source§fn clone(&self) -> StringSchema
fn clone(&self) -> StringSchema
Returns a duplicate of the value. Read more
1.0.0 · 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 StringSchema
impl Debug for StringSchema
Auto Trait Implementations§
impl Freeze for StringSchema
impl RefUnwindSafe for StringSchema
impl Send for StringSchema
impl Sync for StringSchema
impl Unpin for StringSchema
impl UnwindSafe for StringSchema
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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