+
Skip to content

Add aws dynamo db component #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed

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
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载