Skip to main content

GSITable

Trait GSITable 

Source
pub trait GSITable: DynamoTable {
    const GSI_PARTITION_KEY: &'static str;
    const GSI_SORT_KEY: Option<&'static str> = None;

    // Required method
    fn gsi_partition_key(&self) -> String;

    // Provided methods
    fn gsi_sort_key(&self) -> Option<String> { ... }
    fn global_index_name() -> String { ... }
    fn query_gsi_items(
        gsi_partition_key: String,
        gsi_sort_key: Option<String>,
        limit: Option<u16>,
        exclusive_start_key: Option<String>,
    ) -> impl Future<Output = Result<OutputItems<Self>, Error>> { ... }
    fn reverse_query_gsi_items(
        gsi_partition_key: String,
        gsi_sort_key: Option<String>,
        limit: Option<u16>,
        exclusive_start_key: Option<String>,
    ) -> impl Future<Output = Result<OutputItems<Self>, Error>> { ... }
    fn query_gsi_item(
        gsi_partition_key: String,
        gsi_sort_key: Option<String>,
    ) -> impl Future<Output = Result<Option<Self>, Error>> { ... }
    fn query_gsi_items_with_filter<U: Serialize>(
        gsi_partition_key: String,
        gsi_sort_key: Option<String>,
        exclusive_start_key: Option<String>,
        limit: Option<u16>,
        scan_index_forward: bool,
        filter_expression: String,
        filter_expression_values: U,
    ) -> impl Future<Output = Result<OutputItems<Self>, Error>> { ... }
    fn count_gsi_items(
        gsi_partition_key: String,
    ) -> impl Future<Output = Result<usize, Error>> { ... }
}
Expand description

Global Secondary Index (GSI) table trait for querying on alternate keys

Required Associated Constants§

Source

const GSI_PARTITION_KEY: &'static str

GSI partition key field name

Provided Associated Constants§

Source

const GSI_SORT_KEY: Option<&'static str> = None

GSI sort key field name (optional)

Required Methods§

Source

fn gsi_partition_key(&self) -> String

Returns the GSI partition key value for this item

Provided Methods§

Source

fn gsi_sort_key(&self) -> Option<String>

Returns the GSI sort key value for this item (optional)

Source

fn global_index_name() -> String

GSI index name

Source

fn query_gsi_items( gsi_partition_key: String, gsi_sort_key: Option<String>, limit: Option<u16>, exclusive_start_key: Option<String>, ) -> impl Future<Output = Result<OutputItems<Self>, Error>>

Query items using the GSI

Source

fn reverse_query_gsi_items( gsi_partition_key: String, gsi_sort_key: Option<String>, limit: Option<u16>, exclusive_start_key: Option<String>, ) -> impl Future<Output = Result<OutputItems<Self>, Error>>

Query items using the GSI in reverse order

Source

fn query_gsi_item( gsi_partition_key: String, gsi_sort_key: Option<String>, ) -> impl Future<Output = Result<Option<Self>, Error>>

Query a single item using the GSI

Source

fn query_gsi_items_with_filter<U: Serialize>( gsi_partition_key: String, gsi_sort_key: Option<String>, exclusive_start_key: Option<String>, limit: Option<u16>, scan_index_forward: bool, filter_expression: String, filter_expression_values: U, ) -> impl Future<Output = Result<OutputItems<Self>, Error>>

Query items using the GSI with filter expression

Source

fn count_gsi_items( gsi_partition_key: String, ) -> impl Future<Output = Result<usize, Error>>

Count items by GSI partition key

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§