Dynamo DB属性类型布尔 [英] Dynamo DB Attribute type boolean

查看:150
本文介绍了Dynamo DB属性类型布尔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么属性定义只能是`{字符串,数字,二进制)类型。

Why can an attribute definition only be of types `{string, number, binary).

请参见
Java SDK类 com.amazonaws.services.dynamodbv2.model.AttributeDefinition 文档

如果我试图定义类型为 BOOL 的布尔属性,该怎么办?如此处此处作为不同于数字的类型(也许这已经是问题了,也许我不应该尝试这样做?)

What if I am trying to define a boolean attribute of type BOOL as mentioned here or here as a distinct type from a number (perhaps this is already the problem, maybe I shouldn't be trying to do this?)

我不清楚为什么我无法将属性类型明确定义为 BOOL 。这是因为它实际上只是一个 0/1 的数字吗?如果没有其他文档将布尔作为布尔类型表示为Java SDK中的不同类型和注释,我会以为是上述假设,例如 com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBConvertedBool @DynamoDBTyped(DynamoDBMapperFieldModel.DynamoDBAttributeType.BOOL)似乎再次表明存在某种类型的不同定义可以使用。

I'm not clear why I cannot define the attribute type explicitly as BOOL. Is this because it's actually just a number 0/1? I would have assumed the above, had it not been for other documentation which talks about booleans as distinct type and annotations in the Java SDK like com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBConvertedBool or @DynamoDBTyped(DynamoDBMapperFieldModel.DynamoDBAttributeType.BOOL) which again seems to indicate that there is some type of distinct definition that can be used.

推荐答案

这仅是关键属性的情况


每个主要key属性必须为标量(意味着它只能将
保留为一个值)。主键
属性唯一允许的数据类型是字符串,数字或二进制。对于其他非关键属性没有这样的
限制。

Each primary key attribute must be a scalar (meaning that it can hold only a single value). The only data types allowed for primary key attributes are string, number, or binary. There are no such restrictions for other, non-key attributes.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ HowItWorks.CoreComponents.html#HowItWorks.CoreComponents.PrimaryKey

这篇关于Dynamo DB属性类型布尔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆