我对s/union的理解是,您可以使用它与相同的层次结构的两个规范结合,如(s/union ::user/private ::user/public)。
我想要的这里是有如这个JSON结构的层次结构
{"TransactItems": [{"Get": {"TableName": "string", "Key": "string"}}]}
(s/def ::transact-schema (s/schema [::TableName ::Item ::Key ::ConditionExpression]))
(s/def ::Get (s/select ::transact-schema [::TableName ::Key]))
(s/def ::ConditionCheck 条件检查(s/select ::transact-schema [::TableName ::Key ::ConditionExpression]))
(s/def ::Put 插入(s/select ::transact-schema [::TableName ::Item]))
(s/def ::TransactGetItem 事务获取项(s/schema [::Get]))
(s/def ::TransactWriteItem 事务写入项(s/schema [::ConditionCheck ::Put]))
(s/def ::TransactItems 事务项
:get (s/coll-of ::TransactGetItem :kind vector?))
:write (s/coll-of ::TransactWriteItem :kind vector?)))
在这里,我指定了内部层级“获取”的值(包含“TableName”和“Key”作为键的映射)和外部层级“事务项”的值(包含“获取”作为键的映射数组,或者包含“插入”和“条件检查”作为键的映射数组)。
来源:
https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactGetItems.html