Skip to content

Proposal: Data Mapper #3294

@raduendv

Description

@raduendv

Describe the feature

Proposal: Add an "enhanced DynamoDB client" to the AWS SDK for Go v2, providing a strongly-typed, extensible, and ergonomic API for working with DynamoDB tables. This would include support for batch operations, schema mapping, extension hooks, and utilities for encoding/decoding Go structs to DynamoDB items.

Use Case

Many of us working with DynamoDB need a higher-level, type-safe API that reduces boilerplate and improves maintainability. A built-in enhanced client would simplify CRUD operations, batch reads/writes, and schema management, and would be especially valuable for applications requiring custom extensions, efficient batch processing, and strong compile-time guarantees.

Proposed Solution

Introduce a generic Table abstraction, batch read/write operations, schema builders, and extension registries as part of the SDK. These would wrap the low-level DynamoDB API with higher-level, idiomatic Go constructs. Batch operations should include retry logic and error thresholds. The design should allow for custom extension points and support for Go generics.

Example Usage

type Order struct {
	OrderID   string
	Customer  string
	Total     float64
}

schema := enhancedclient.NewSchema[Order]().WithName("orders")

// Create a strongly-typed table
table, err := enhancedclient.NewTable[Order]
    ddbClient,
    enhancedclient.WithSchema(schema), // optional
)
if err != nil {
	// handle error
}

// Put an item
order := &Order{OrderID: "123", Customer: "Alice", Total: 42.0}
_, err = table.PutItem(ctx, order)

// Get an item
result, err := table.GetItem(ctx, enhancedclient.Map{"order_id": &types.AttributeValueMemberS{Value: "123"}})
// result is instance of Order{}

Other Information

  • Batch get/put/delete with iterators
  • Schema-based encoding/decoding for Go structs
  • Extension registry for custom behaviors
  • Utilities for field mapping and attribute value conversion
  • Comprehensive test coverage for table and batch operations

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS Go SDK V2 Module Versions Used

	github.com/aws/aws-sdk-go-v2 v1.39.4
	github.com/aws/aws-sdk-go-v2/config v1.31.15
	github.com/aws/aws-sdk-go-v2/feature/dynamodb/expression v1.8.19
	github.com/aws/aws-sdk-go-v2/service/dynamodb v1.52.2
	github.com/aws/smithy-go v1.23.1

Go version used

go 1.23.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestA feature should be added or improved.p2This is a standard priority issuequeuedThis issues is on the AWS team's backlog

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions