add keypair to transactkey

This commit is contained in:
2025-05-24 11:23:26 -03:00
parent 0982987ac1
commit c7cf30859a
3 changed files with 9 additions and 6 deletions

View File

@@ -312,12 +312,14 @@ class TransactKey:
pk: str pk: str
pairs: tuple[KeyPair, ...] = () pairs: tuple[KeyPair, ...] = ()
def __add__(self, other: SortKey) -> 'TransactKey': def __add__(self, other: SortKey | KeyPair) -> 'TransactKey':
if not isinstance(other, SortKey): if not isinstance(other, SortKey):
raise TypeError('Can only add a SortKey to a TransactKey') raise TypeError('Can only add a SortKey to a TransactKey')
pair = KeyPair(self.pk, other) if isinstance(other, SortKey):
return TransactKey(pk=self.pk, pairs=self.pairs + (pair,)) other = KeyPair(self.pk, other)
return TransactKey(pk=self.pk, pairs=self.pairs + (other,))
class TransactionCanceledReason(TypedDict): class TransactionCanceledReason(TypedDict):
@@ -756,6 +758,7 @@ class DynamoDBCollection:
""" """
DynamoDBCollection provides a high-level abstraction for performing common DynamoDBCollection provides a high-level abstraction for performing common
CRUD operations and queries on a DynamoDB table. CRUD operations and queries on a DynamoDB table.
It leverages an underlying persistence layer to handle It leverages an underlying persistence layer to handle
serialization and deserialization of data, key composition, transaction operations, serialization and deserialization of data, key composition, transaction operations,
and TTL management. and TTL management.
@@ -765,7 +768,7 @@ class DynamoDBCollection:
- Insert (put) items with optional TTL (time-to-live) settings. - Insert (put) items with optional TTL (time-to-live) settings.
- Delete items based on keys and conditions. - Delete items based on keys and conditions.
- Query items using partition keys or composite key pairs with - Query items using partition keys or composite key pairs with
optional filtering and pagination. optional filtering and pagination.
Parameters Parameters
---------- ----------

View File

@@ -1,6 +1,6 @@
[project] [project]
name = "layercake" name = "layercake"
version = "0.3.3" version = "0.3.4"
description = "Packages shared dependencies to optimize deployment and ensure consistency across functions." description = "Packages shared dependencies to optimize deployment and ensure consistency across functions."
readme = "README.md" readme = "README.md"
authors = [ authors = [

2
layercake/uv.lock generated
View File

@@ -589,7 +589,7 @@ wheels = [
[[package]] [[package]]
name = "layercake" name = "layercake"
version = "0.3.2" version = "0.3.3"
source = { editable = "." } source = { editable = "." }
dependencies = [ dependencies = [
{ name = "arnparse" }, { name = "arnparse" },