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
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
----------

View File

@@ -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 = [

2
layercake/uv.lock generated
View File

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