【发布时间】:2015-12-31 01:19:22
【问题描述】:
我有一条路线可以返回有关用户帐户功能的详细信息:
// games[{keys:games}].features[{integers:indices}]
{
$type : "atom",
value : {
id: "6",
count: "1",
...
}
}
还有一条返回特定功能的通用详细信息的路由:
// features[{integers:features}]
{
$type : "atom",
value : {
name : "fooga",
max : 10,
...
}
}
我不想将通用特征数据合并到特定于用户的数据中,因为那将是一堆数据重复,但我也希望能够在一个请求中获得所有数据
有什么聪明的方法来构造我的路由/返回的数据,以便games[{keys:games}].features[{integers:indices}] 可以返回对features[{integers:features}] 的有用引用?
我试着像这样把它们分开:
// games[{keys:games}].features[{integers:indices}].details
{
$type : "atom",
value : {
id: "6",
count: "1",
...
}
}
// games[{keys:games}].features[{integers:indices}].meta
{
$type : "ref",
value : [
"features",
"15"
]
}
但我无法找到解决 .meta 引用的方法,而无需编写像 ...features.0.meta.[name,max,...] 这样的看似冗余的路径。理想情况下,ref 只会返回一个原子,因为它是少量数据。
【问题讨论】:
标签: falcor falcor-router