pub struct TableSchema {
pub local_indexes: Vec<LocalSecondaryIndex>,
pub global_indexes: Vec<GlobalSecondaryIndex>,
pub ttl_attribute_name: Option<String>,
pub stream_config: StreamConfig,
}Expand description
Table schema with index definitions
Fields§
§local_indexes: Vec<LocalSecondaryIndex>Local secondary indexes
global_indexes: Vec<GlobalSecondaryIndex>Global secondary indexes (Phase 3.2+)
ttl_attribute_name: Option<String>TTL attribute name (Phase 3.3+) When set, items with this attribute containing a timestamp in the past are considered expired
stream_config: StreamConfigStream configuration (Phase 3.4+)
Implementations§
Source§impl TableSchema
impl TableSchema
Sourcepub fn add_local_index(self, index: LocalSecondaryIndex) -> Self
pub fn add_local_index(self, index: LocalSecondaryIndex) -> Self
Add a local secondary index
Sourcepub fn get_local_index(&self, name: &str) -> Option<&LocalSecondaryIndex>
pub fn get_local_index(&self, name: &str) -> Option<&LocalSecondaryIndex>
Get LSI by name
Sourcepub fn add_global_index(self, index: GlobalSecondaryIndex) -> Self
pub fn add_global_index(self, index: GlobalSecondaryIndex) -> Self
Add a global secondary index (Phase 3.2+)
Sourcepub fn get_global_index(&self, name: &str) -> Option<&GlobalSecondaryIndex>
pub fn get_global_index(&self, name: &str) -> Option<&GlobalSecondaryIndex>
Get GSI by name (Phase 3.2+)
Sourcepub fn with_ttl(self, attribute_name: impl Into<String>) -> Self
pub fn with_ttl(self, attribute_name: impl Into<String>) -> Self
Enable TTL (Time To Live) with the specified attribute name (Phase 3.3+)
Items with this attribute containing a Unix timestamp (seconds since epoch) in the past will be considered expired and automatically deleted.
Sourcepub fn with_stream(self, config: StreamConfig) -> Self
pub fn with_stream(self, config: StreamConfig) -> Self
Enable streams (Change Data Capture) with the specified configuration (Phase 3.4+)
Streams capture all item-level modifications (INSERT, MODIFY, REMOVE) and make them available for processing.
Sourcepub fn is_expired(&self, item: &Item) -> bool
pub fn is_expired(&self, item: &Item) -> bool
Check if an item is expired based on TTL (Phase 3.3+)
Returns true if:
- TTL is enabled AND
- Item has the TTL attribute AND
- The TTL timestamp is in the past
Trait Implementations§
Source§impl Clone for TableSchema
impl Clone for TableSchema
Source§fn clone(&self) -> TableSchema
fn clone(&self) -> TableSchema
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more