cipherstash_dynamodb/encrypted_table/
table_entry.rs

1use super::{table_attribute::TableAttribute, table_attributes::TableAttributes, AttributeName};
2
3pub struct TableEntry {
4    pub(crate) pk: String,
5    pub(crate) sk: String,
6    pub(crate) term: Option<Vec<u8>>,
7    pub(crate) attributes: TableAttributes,
8}
9
10impl TableEntry {
11    pub fn new(pk: String, sk: String) -> Self {
12        Self {
13            pk,
14            sk,
15            term: None,
16            attributes: TableAttributes::new(),
17        }
18    }
19
20    pub fn new_with_attributes(
21        pk: String,
22        sk: String,
23        term: Option<Vec<u8>>,
24        attributes: TableAttributes,
25    ) -> Self {
26        Self {
27            pk,
28            sk,
29            term,
30            attributes,
31        }
32    }
33
34    pub fn add_attribute(&mut self, name: impl Into<AttributeName>, v: TableAttribute) {
35        self.attributes.insert(name.into(), v);
36    }
37}