diff --git a/layercake/layercake/dynamodb.py b/layercake/layercake/dynamodb.py index 5966c0f..c543edd 100644 --- a/layercake/layercake/dynamodb.py +++ b/layercake/layercake/dynamodb.py @@ -312,12 +312,14 @@ class TransactKey: pk: str pairs: tuple[KeyPair, ...] = () - def __add__(self, other: SortKey) -> 'TransactKey': + def __add__(self, other: SortKey | KeyPair) -> 'TransactKey': if not isinstance(other, SortKey): raise TypeError('Can only add a SortKey to a TransactKey') - pair = KeyPair(self.pk, other) - return TransactKey(pk=self.pk, pairs=self.pairs + (pair,)) + if isinstance(other, SortKey): + other = KeyPair(self.pk, other) + + return TransactKey(pk=self.pk, pairs=self.pairs + (other,)) class TransactionCanceledReason(TypedDict): @@ -756,6 +758,7 @@ class DynamoDBCollection: """ DynamoDBCollection provides a high-level abstraction for performing common CRUD operations and queries on a DynamoDB table. + It leverages an underlying persistence layer to handle serialization and deserialization of data, key composition, transaction operations, and TTL management. @@ -765,7 +768,7 @@ class DynamoDBCollection: - Insert (put) items with optional TTL (time-to-live) settings. - Delete items based on keys and conditions. - Query items using partition keys or composite key pairs with - optional filtering and pagination. + optional filtering and pagination. Parameters ---------- diff --git a/layercake/pyproject.toml b/layercake/pyproject.toml index 045d5bc..5ea55fb 100644 --- a/layercake/pyproject.toml +++ b/layercake/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "layercake" -version = "0.3.3" +version = "0.3.4" description = "Packages shared dependencies to optimize deployment and ensure consistency across functions." readme = "README.md" authors = [ diff --git a/layercake/uv.lock b/layercake/uv.lock index ad85169..b6ea58d 100644 --- a/layercake/uv.lock +++ b/layercake/uv.lock @@ -589,7 +589,7 @@ wheels = [ [[package]] name = "layercake" -version = "0.3.2" +version = "0.3.3" source = { editable = "." } dependencies = [ { name = "arnparse" },