Documentation
¶
Overview ¶
Package tabletheory provides a type-safe ORM for Amazon DynamoDB in Go.
Import path:
import "github.com/theory-cloud/tabletheory/v6"
Implementation lives in `internal/theorydb` so the repo root stays minimal.
Index ¶
- Variables
- func AtVersion(version int64) core.TransactCondition
- func Condition(field, operator string, value any) core.TransactCondition
- func ConditionExpression(expression string, values map[string]any) core.TransactCondition
- func ConditionVersion(version int64) core.TransactCondition
- func DefaultBatchGetOptions() *core.BatchGetOptions
- func EnableXRayTracing() bool
- func GetLambdaMemoryMB() int
- func GetPartnerFromContext(ctx context.Context) string
- func GetRemainingTimeMillis(ctx context.Context) int64
- func IfExists() core.TransactCondition
- func IfNotExists() core.TransactCondition
- func IsLambdaEnvironment() bool
- func ModelOf[T any](db core.DB) typed.Model[T]
- func New(config session.Config) (core.ExtendedDB, error)
- func NewBasic(config session.Config) (core.DB, error)
- func NewKeyPair(partitionKey any, sortKey ...any) core.KeyPair
- func NewTypedKey[T any](partitionKey any, sortKey ...any) typed.Key[T]
- func NewWithClient(config session.Config, client session.DynamoDBAPI) (core.ExtendedDB, error)
- func PartnerContext(ctx context.Context, partnerID string) context.Context
- func UnmarshalItem(item map[string]types.AttributeValue, dest interface{}) error
- func UnmarshalItems(items []map[string]types.AttributeValue, dest interface{}) error
- func UnmarshalStreamImage(streamImage map[string]events.DynamoDBAttributeValue, dest interface{}) error
- type AccountConfig
- type AutoMigrateOption
- type BatchGetOptions
- type ColdStartMetrics
- type Config
- type DB
- type DynamoDBAPI
- type KeyPair
- type LambdaDB
- type LambdaMemoryStats
- type LambdaTimeoutConfig
- type MultiAccountDB
- type TypedExtendedDB
Constants ¶
This section is empty.
Variables ¶
var ( WithBackupTable = schema.WithBackupTable WithDataCopy = schema.WithDataCopy WithTargetModel = schema.WithTargetModel WithTransform = schema.WithTransform WithBatchSize = schema.WithBatchSize )
Re-export AutoMigrate options for convenience.
Functions ¶
func AtVersion ¶
func AtVersion(version int64) core.TransactCondition
func ConditionExpression ¶
func ConditionExpression(expression string, values map[string]any) core.TransactCondition
func ConditionVersion ¶
func ConditionVersion(version int64) core.TransactCondition
func DefaultBatchGetOptions ¶
func DefaultBatchGetOptions() *core.BatchGetOptions
func EnableXRayTracing ¶
func EnableXRayTracing() bool
func GetLambdaMemoryMB ¶
func GetLambdaMemoryMB() int
func GetPartnerFromContext ¶
func GetRemainingTimeMillis ¶
func IfExists ¶
func IfExists() core.TransactCondition
func IfNotExists ¶
func IfNotExists() core.TransactCondition
func IsLambdaEnvironment ¶
func IsLambdaEnvironment() bool
func NewWithClient ¶
func NewWithClient(config session.Config, client session.DynamoDBAPI) (core.ExtendedDB, error)
NewWithClient creates a TableTheory instance backed by an injected DynamoDBAPI. It is intended for deterministic consumer tests and local fakes.
func UnmarshalItem ¶
func UnmarshalItem(item map[string]types.AttributeValue, dest interface{}) error
func UnmarshalItems ¶
func UnmarshalItems(items []map[string]types.AttributeValue, dest interface{}) error
func UnmarshalStreamImage ¶
func UnmarshalStreamImage(streamImage map[string]events.DynamoDBAttributeValue, dest interface{}) error
Types ¶
type AccountConfig ¶
type AccountConfig = internaltheorydb.AccountConfig
type AutoMigrateOption ¶
type AutoMigrateOption = schema.AutoMigrateOption
type BatchGetOptions ¶
type BatchGetOptions = core.BatchGetOptions
type ColdStartMetrics ¶
type ColdStartMetrics = internaltheorydb.ColdStartMetrics
func BenchmarkColdStart ¶
func BenchmarkColdStart(models ...any) ColdStartMetrics
type DB ¶
type DB = internaltheorydb.DB
type DynamoDBAPI ¶
type DynamoDBAPI = session.DynamoDBAPI
type LambdaDB ¶
type LambdaDB = internaltheorydb.LambdaDB
func LambdaInit ¶
func NewLambdaOptimized ¶
type LambdaMemoryStats ¶
type LambdaMemoryStats = internaltheorydb.LambdaMemoryStats
type LambdaTimeoutConfig ¶
type LambdaTimeoutConfig = internaltheorydb.LambdaTimeoutConfig
type MultiAccountDB ¶
type MultiAccountDB = internaltheorydb.MultiAccountDB
func NewMultiAccount ¶
func NewMultiAccount(accounts map[string]AccountConfig) (*MultiAccountDB, error)
type TypedExtendedDB ¶
type TypedExtendedDB = core.TypedExtendedDB
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
tabletheory
command
|
|
|
tabletheory-contract
command
|
|
|
Package examples demonstrates TableTheory's embedded struct support
|
Package examples demonstrates TableTheory's embedded struct support |
|
cdk-multilang/lambdas/go
command
|
|
|
cdk-multilang/local/go
command
Command local-writer writes the shared cdk-multilang DemoItem to a local DynamoDB and KMS (no AWS account).
|
Command local-writer writes the shared cdk-multilang DemoItem to a local DynamoDB and KMS (no AWS account). |
|
drivers
command
Package main drives the loose examples/*.go snippets against DynamoDB Local.
|
Package main drives the loose examples/*.go snippets against DynamoDB Local. |
|
encryption
command
|
|
|
initialization
command
Package main demonstrates proper TableTheory initialization patterns to avoid nil pointer dereference errors
|
Package main demonstrates proper TableTheory initialization patterns to avoid nil pointer dereference errors |
|
lambda
command
|
|
|
local-quickstart
command
|
|
|
optimization
command
|
|
|
payment/lambda/process
command
|
|
|
payment/lambda/query
command
|
|
|
payment/lambda/reconcile
command
|
|
|
release-state
command
|
|
|
typed-go
command
Package main drives the typed generic API against DynamoDB Local.
|
Package main drives the typed generic API against DynamoDB Local. |
|
internal
|
|
|
dynamodbprobe
Package dynamodbprobe verifies that a local endpoint actually speaks the DynamoDB protocol instead of merely accepting HTTP connections.
|
Package dynamodbprobe verifies that a local endpoint actually speaks the DynamoDB protocol instead of merely accepting HTTP connections. |
|
dynamodbprobe/cmd/dynamodb-local-check
command
Command dynamodb-local-check exits 0 when the endpoint speaks the DynamoDB protocol and non-zero with a clear message otherwise.
|
Command dynamodb-local-check exits 0 when the endpoint speaks the DynamoDB protocol and non-zero with a clear message otherwise. |
|
safeoutput
Package safeoutput writes generated and scaffolded files through an os.Root-confined, atomic rename so that a symlink in the destination path cannot redirect a write to an unrelated victim file outside its intended directory.
|
Package safeoutput writes generated and scaffolded files through an os.Root-confined, atomic rename so that a symlink in the destination path cannot redirect a write to an unrelated victim file outside its intended directory. |
|
theorydb
lambda.go
|
lambda.go |
|
pkg
|
|
|
consistency
Package consistency provides utilities for handling eventual consistency in DynamoDB
|
Package consistency provides utilities for handling eventual consistency in DynamoDB |
|
core
Package core defines the core interfaces and types for TableTheory
|
Package core defines the core interfaces and types for TableTheory |
|
errors
Package errors defines error types and utilities for TableTheory
|
Package errors defines error types and utilities for TableTheory |
|
interfaces
Package interfaces provides abstractions for AWS SDK operations to enable mocking
|
Package interfaces provides abstractions for AWS SDK operations to enable mocking |
|
lease
Package lease provides a small, correctness-first DynamoDB lease/lock helper.
|
Package lease provides a small, correctness-first DynamoDB lease/lock helper. |
|
marshal
Package marshal provides optimized marshaling for DynamoDB
|
Package marshal provides optimized marshaling for DynamoDB |
|
mocks
Package mocks provides mock implementations for TableTheory interfaces and AWS SDK operations
|
Package mocks provides mock implementations for TableTheory interfaces and AWS SDK operations |
|
model
Package model provides model registration and metadata management for TableTheory
|
Package model provides model registration and metadata management for TableTheory |
|
query
Package query provides aggregate functionality for DynamoDB queries
|
Package query provides aggregate functionality for DynamoDB queries |
|
releasestate
Package releasestate contains opt-in helpers for release-state registry records.
|
Package releasestate contains opt-in helpers for release-state registry records. |
|
session
Package session provides AWS session management and DynamoDB client configuration
|
Package session provides AWS session management and DynamoDB client configuration |
|
testing
Package testing provides utilities for testing applications that use TableTheory.
|
Package testing provides utilities for testing applications that use TableTheory. |
|
testing/fakedb
Package fakedb provides a deterministic, state-backed DynamoDBAPI fake for consumer tests.
|
Package fakedb provides a deterministic, state-backed DynamoDBAPI fake for consumer tests. |
|
transaction
Package transaction provides atomic transaction support for TableTheory
|
Package transaction provides atomic transaction support for TableTheory |
|
typed
Package typed provides additive generic wrappers around the stable TableTheory core interfaces.
|
Package typed provides additive generic wrappers around the stable TableTheory core interfaces. |
|
types
Package types provides type conversion between Go types and DynamoDB AttributeValues
|
Package types provides type conversion between Go types and DynamoDB AttributeValues |
|
scripts
|
|
|
internal/dms_first_workflow
command
|
|
|
internal/expression_hardening
command
|
|
|
internal/public_api_contracts
command
|
|
|
internal/validation_parity
command
|
|
|
local/cmd/examples-local-cdk-fixtures
command
Command examples-local-cdk-fixtures prepares and inspects the local state the cdk-multilang rows need: it provisions the shared demo table, the TTL evidence table and the archive bucket, reads an encrypted item back in its raw DynamoDB envelope form, generates a DynamoDB stream REMOVE record from a real local write and delete, and reads the archive object the deployed archive handler wrote to the local S3 emulator.
|
Command examples-local-cdk-fixtures prepares and inspects the local state the cdk-multilang rows need: it provisions the shared demo table, the TTL evidence table and the archive bucket, reads an encrypted item back in its raw DynamoDB envelope form, generates a DynamoDB stream REMOVE record from a real local write and delete, and reads the archive object the deployed archive handler wrote to the local S3 emulator. |
|
local/cmd/examples-local-kms-key
command
Command examples-local-kms-key provisions the KMS key the encryption examples use and proves the local KMS can wrap and unwrap a data key with the same EncryptionContext the framework's v2 envelope sends.
|
Command examples-local-kms-key provisions the KMS key the encryption examples use and proves the local KMS can wrap and unwrap a data key with the same EncryptionContext the framework's v2 envelope sends. |
|
local/cmd/examples-local-lambda-preflight
command
Command examples-local-lambda-preflight runs inside the Lambda runtime container before any example handler and proves the function environment cannot reach real AWS: every SDK endpoint resolves to the local profile's service, only the harness dummy credentials are available, each backend speaks its AWS protocol, and a real AWS hostname does not resolve.
|
Command examples-local-lambda-preflight runs inside the Lambda runtime container before any example handler and proves the function environment cannot reach real AWS: every SDK endpoint resolves to the local profile's service, only the harness dummy credentials are available, each backend speaks its AWS protocol, and a real AWS hostname does not resolve. |
|
local/cmd/examples-local-payment-fixtures
command
Command examples-local-payment-fixtures provisions the local DynamoDB tables the Lambda and payment examples use, seeds fixture rows through the real TableTheory models, publishes a reconciliation object to the local S3 emulator, and reads the stored state back for harness assertions.
|
Command examples-local-payment-fixtures provisions the local DynamoDB tables the Lambda and payment examples use, seeds fixture rows through the real TableTheory models, publishes a reconciliation object to the local S3 emulator, and reads the stored state back for harness assertions. |
|
local/cmd/examples-local-preflight
command
Command examples-local-preflight proves the environment the example harness hands to every child process resolves DynamoDB, KMS, STS, S3 and SQS to the checked-in local profile instead of the real AWS endpoints, that the SDK sees nothing but the harness's static dummy credentials, and that each local backend speaks its real AWS protocol.
|
Command examples-local-preflight proves the environment the example harness hands to every child process resolves DynamoDB, KMS, STS, S3 and SQS to the checked-in local profile instead of the real AWS endpoints, that the SDK sees nothing but the harness's static dummy credentials, and that each local backend speaks its real AWS protocol. |
|
local/cmd/examples-local-stream-event
command
Command examples-local-stream-event performs one real DynamoDB write through TableTheory, reads the stored item back with GetItem, and prints a DynamoDB stream record built from that stored image.
|
Command examples-local-stream-event performs one real DynamoDB write through TableTheory, reads the stored item back with GetItem, and prints a DynamoDB stream record built from that stored image. |