Skip to content

feat: allow providing dynamic client option to go() method #543

@anatolzak

Description

@anatolzak

Summary

Add support for passing a DynamoDB client dynamically at query execution time via the go() method options, allowing per-request client selection without modifying the Entity/Service instance.

Motivation

Currently, the DynamoDB client must be set at Entity/Service instantiation time or via setClient(). This creates challenges for:

  • Multi-region routing: Directing queries to different AWS regions based on user location or data residency
  • Multi-tenancy: Supporting different AWS accounts per tenant

Proposed API

await entity.get({ id }).go({ client: dynamicClient });

Expected Behavior

  1. The client passed in go() options takes precedence over the instance client
  2. Both v2 and v3 AWS SDK clients should be supported and auto-detected
  3. If no client exists at instance level and none provided at go() time, throw a clear error
  4. The dynamic client should be used for all pages during pagination

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions