Goa.Clients.Dynamo
0.9.0-preview
dotnet add package Goa.Clients.Dynamo --version 0.9.0-preview
NuGet\Install-Package Goa.Clients.Dynamo -Version 0.9.0-preview
<PackageReference Include="Goa.Clients.Dynamo" Version="0.9.0-preview" />
<PackageVersion Include="Goa.Clients.Dynamo" Version="0.9.0-preview" />
<PackageReference Include="Goa.Clients.Dynamo" />
paket add Goa.Clients.Dynamo --version 0.9.0-preview
#r "nuget: Goa.Clients.Dynamo, 0.9.0-preview"
#:package Goa.Clients.Dynamo@0.9.0-preview
#addin nuget:?package=Goa.Clients.Dynamo&version=0.9.0-preview&prerelease
#tool nuget:?package=Goa.Clients.Dynamo&version=0.9.0-preview&prerelease
Goa.Clients.Dynamo
A high-performance DynamoDB client optimized for AWS Lambda functions. This package provides a lightweight, AOT-ready DynamoDB client with strongly-typed operations and comprehensive error handling using the ErrorOr pattern.
Installation
dotnet add package Goa.Clients.Dynamo
Features
- Native AOT support for faster Lambda cold starts
- Strongly-typed request/response objects
- Minimal dependencies and memory allocations
- Built-in error handling with ErrorOr pattern
- Support for all DynamoDB operations (Get, Put, Update, Delete, Query, Scan, Batch, Transactions)
- DynamoDB model attributes for structured data access
Usage
Basic Setup
using Goa.Clients.Dynamo;
using Microsoft.Extensions.DependencyInjection;
// Register DynamoDB client
services.AddDynamoDB();
// Or with custom configuration
services.AddDynamoDB(config =>
{
config.ServiceUrl = "http://localhost:8000"; // For local DynamoDB
config.Region = "us-west-2";
config.LogLevel = LogLevel.Debug;
});
Model Definition with Attributes
[DynamoModel(PK = "USER#<Id>", SK = "PROFILE")]
[GlobalSecondaryIndex(Name = "EmailIndex", PK = "EMAIL#<Email>", SK = "USER")]
public class User
{
public string Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
}
Basic Operations
using ErrorOr;
using Goa.Clients.Dynamo;
using Goa.Clients.Dynamo.Models;
using Goa.Clients.Dynamo.Operations.GetItem;
using Goa.Clients.Dynamo.Operations.PutItem;
public class UserService
{
private readonly IDynamoClient _client;
public UserService(IDynamoClient client)
{
_client = client;
}
public async Task<ErrorOr<User>> GetUserAsync(string userId)
{
var result = await _client.GetItemAsync("Users", builder =>
{
builder
.WithKey("PK", $"USER#{userId}")
.WithKey("SK", "PROFILE");
});
if (result.IsError)
return result.FirstError;
// Convert DynamoRecord to User object
if (result.Value.Item == null)
return Error.NotFound("User.NotFound", "User not found");
return ConvertToUser(result.Value.Item);
}
public async Task<ErrorOr<Success>> SaveUserAsync(User user)
{
var result = await _client.PutItemAsync("Users", builder =>
{
builder
.WithAttribute("PK", $"USER#{user.Id}")
.WithAttribute("SK", "PROFILE")
.WithAttribute("Name", user.Name)
.WithAttribute("Email", user.Email);
});
return result.IsError ? result.FirstError : Result.Success;
}
}
Query Operations
using Goa.Clients.Dynamo.Operations.Query;
using Goa.Clients.Dynamo.Models;
public async Task<ErrorOr<List<User>>> GetUsersByEmailAsync(string email)
{
var users = await _client.QueryAllAsync("Users", builder =>
{
builder
.WithIndex("EmailIndex")
.WithKey(Condition.Equals("GSI_1_PK", $"EMAIL#{email}"));
}).ToListAsync();
return users.Select(ConvertToUser).ToList();
}
Available Operations
- GetItem: Retrieve a single item by primary key
- PutItem: Create or replace an item
- UpdateItem: Modify specific attributes of an item
- DeleteItem: Remove an item from the table
- Query: Find items using primary key and optional filters
- Scan: Read all items in a table with optional filters
- BatchGetItem: Retrieve multiple items in a single request
- BatchWriteItem: Put or delete multiple items in a single request
- TransactWriteItems: Execute multiple write operations atomically
- TransactGetItems: Retrieve multiple items atomically
Error Handling
All operations return ErrorOr<T> results, providing comprehensive error handling:
var result = await _client.GetItemAsync(request);
if (result.IsError)
{
// Handle errors
foreach (var error in result.Errors)
{
Console.WriteLine($"Error: {error.Description}");
}
return;
}
// Use successful result
var item = result.Value.Item;
Documentation
For more information and examples, visit the main Goa documentation.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- ErrorOr (>= 2.0.1)
- Goa.Clients.Core (>= 0.9.0-preview)
- Goa.Clients.Dynamo.Analyzers (>= 0.9.0-preview)
- Goa.Clients.Dynamo.Generator (>= 0.9.0-preview)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Goa.Clients.Dynamo:
| Package | Downloads |
|---|---|
|
Goa.Functions.Dynamo
DynamoDB stream processing for high-performance AWS Lambda functions |
|
|
Goa.Clients.Bedrock.Conversation.Dynamo
DynamoDB-backed conversation store for Bedrock-based AI applications with source generator support for high-performance AWS Lambda functions |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.9.0-preview | 0 | 6/18/2026 |
| 0.8.0-preview | 470 | 3/17/2026 |
| 0.7.8-preview | 112 | 3/3/2026 |
| 0.7.7-preview | 73 | 3/3/2026 |
| 0.7.6-preview | 79 | 3/3/2026 |
| 0.7.5-preview | 79 | 3/2/2026 |
| 0.7.4-preview | 75 | 3/1/2026 |
| 0.7.3-preview | 77 | 2/28/2026 |
| 0.7.2-preview | 103 | 2/23/2026 |
| 0.7.1-preview | 205 | 1/26/2026 |
| 0.7.0-preview | 86 | 1/26/2026 |
| 0.2.1-preview | 129 | 1/20/2026 |
| 0.2.0-preview | 160 | 1/14/2026 |
| 0.1.9-preview | 149 | 1/1/2026 |
| 0.1.8-preview | 329 | 12/15/2025 |
| 0.1.7-preview | 221 | 12/15/2025 |
| 0.1.6-preview | 227 | 12/15/2025 |
| 0.1.5-preview | 229 | 12/15/2025 |
| 0.1.4-preview | 239 | 12/15/2025 |
| 0.1.3-preview | 129 | 12/12/2025 |