Skip to content

Conversation

rafa0805
Copy link

@rafa0805 rafa0805 commented Jun 3, 2025

Added component to initialize AWS DynamoDB client.

Component initialization

(component/system-map
   :dynamo-db (tc.ddb.component/map->AwsDynamoDb {:credentials (when-not (= profile :prod)
                                                       create-dev-credentials)
                                        :endpoint (when-not (= profile :prod)
                                                    (URI. development-url))
                                        :region Region/AP_NORTHEAST_1}))

Getting item from DynamoDB table

(let [partition-key {:name "email" :value "sample@example.com"}]
  (tc.ddb.protocol/get-item dynamo-db-component
                            "example-table"
                            partition-key))

The code above will return data like {:name "Tarou" :age 20 :is-student true}.

Limitations

Only string, int, bool is supported at the moment.

(ns toyokumo.commons.aws.dynamo-db.protocol)

(defprotocol IDynamoDb
(get-item [this table-name partition-key]) ; Get item from DynamoDB table using the provided partition key
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be added as needed.

@rafa0805 rafa0805 marked this pull request as ready for review June 3, 2025 08:08
@rafa0805 rafa0805 requested a review from egs33 June 3, 2025 08:11
@rafa0805 rafa0805 closed this Jun 3, 2025
@rafa0805 rafa0805 deleted the add-aws-dynamo-db-component branch June 3, 2025 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant