【发布时间】:2021-07-02 07:24:08
【问题描述】:
使用 GraphQL-ruby,我想为一个字段定义一个类型,该字段在以下结构中保存数据:
[
["2016-06-07", 14134.84],
["2016-06-08", 14134.84],
# ...
]
我该怎么做? 我试过了
module Types
class PerformanceDataType < Types::BaseObject
field :assets, [[Types::AssetType]], null: false
# ....
end
end
module Types
class AssetType < Types::BaseObject
field :date, String, null: false
field :value, Float, null: false
end
end
我还没有使用这些数据,所以我不能说它是否有效,但感觉太不具体了。生成架构没有引发任何错误。
【问题讨论】:
标签: graphql-ruby