DynamoDB auto incremented ID amp; server time (iOS SDK)(DynamoDB 自动递增 ID amp;服务器时间(iOS SDK))
问题描述
DynammoDB 中是否有将自动递增的 ID 作为主键存储在表中的选项?我还需要将服务器时间作为创建于"字段(例如,用户创建于)存储在表中.但我找不到任何方法从 DynamoDB 或任何其他 AWS 服务获取服务器时间.
Is there an option in DynammoDB to store auto incremented ID as primary key in tables? I also need to store the server time in tables as the "created at" fields (eg., user create at). But I don't find any way to get server time from DynamoDB or any other AWS services.
你们能帮帮我吗,
- 在 DyanmoDB 表中使用自动递增的 ID
- 将服务器时间存储在创建于"类似字段的表中.
谢谢.
推荐答案
其实DynamoDB的功能很少,而这正是它的主要优势.简单.
Actually, there are very few features in DynamoDB and this is precisely its main strength. Simplicity.
- 无法自动生成 ID 或 UUID.
- 无法自动生成日期
对于日期"问题,应该很容易在客户端生成.我可以建议您使用 ISO 8601 日期格式吗?它对程序员和计算机都很友好.
For the "date" problem, it should be easy to generate it on the client side. May I suggest you to use the ISO 8601 date format ? It's both programmer and computer friendly.
在大多数情况下,有一种比使用自动 ID 更好的方法.这通常是 SQL 或 MongoDB 世界中的一个坏习惯.例如,电子邮件或登录信息将为用户提供完美的 ID.但我知道在某些特定情况下 ID 可能有用.
Most of the time, there is a better way than using automatic IDs for Items. This is often a bad habit taken from the SQL or MongoDB world. For instance, an e-mail or a login will make a perfect ID for a user. But I know there are specific cases where IDs might be useful.
在这些情况下,您需要构建自己的系统.在这个 SO answer 和 这篇文章来自 DynamoDB-Mapper 文档,我解释了怎么做它.希望对你有帮助
In these cases, you need to build your own system. In this SO answer and this article from DynamoDB-Mapper documentation, I explain how to do it. I hope it helps
这篇关于DynamoDB 自动递增 ID &服务器时间(iOS SDK)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:DynamoDB 自动递增 ID &服务器时间(iOS SDK)


基础教程推荐
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01