In addition to being able to retrieve a path from a Falcor Model, you can also retrieve multiple Path Sets. Path Sets are paths that contain ranges or multiple string keys inside of indexers. In addition to being able to retrieve a Path Set, you can also retrieve as many paths as you like in a single method call.

You can fetch range of data:

model.get('people[0..1].titles[0].name')

Because what you fetch is not just a single a value, you need to use:

model.get()

Which return you a json string.

SO for example:

<!-- index.html -->
<html>
<head>
<!-- Do _not_ rely on this URL in production. Use only during development. -->
<script src="//netflix.github.io/falcor/build/falcor.browser.js"></script>
<script>
var model = new falcor.Model({
cache: {
people: [
{
name: "ZT",
titles: [
{
id: 123,
name: "Senior Frontend developer",
rating: 10
}
]
},
{
name: "WO",
titles: [
{
id: 321,
name: "Senior Software Engineer",
rating: 10
}
]
}
]
}
}); model.get('people[0..1].titles[0].name')
.then(function (json){
console.log(JSON.stringify(json, null, 2));
});
</script>
</head>
<body>
</body>
</html>

And what you will get:

{
"json": {
"people": {
"0": {
"titles": {
"0": {
"name": "Senior Frontend developer"
}
}
},
"1": {
"titles": {
"0": {
"name": "Senior Software Engineer"
}
}
}
}
}
}

You can pass multi enter points:

model.get('people[0..1].titles[0].name', 'people[0..1].titles[0].rating')

So you will get :

{
"json": {
"people": {
"0": {
"titles": {
"0": {
"name": "Senior Frontend developer",
"rating": 10
}
}
},
"1": {
"titles": {
"0": {
"name": "Senior Software Engineer",
"rating": 8
}
}
}
}
}
}

Notice that:

        model.get('people[0..1].titles[0].name',
'people[0..1].titles[0].rating')

The entor points we pass in are quite simialr, actually we can group them:

model.get('people[0..1].titles[0]["name", "rating"]')

You will still get the same result.

[Falcor] Retrieving Multiple Values的更多相关文章

  1. [Go] Returning Multiple Values from a Function in Go

    Returning multiple values from a function is a common idiom in Go, most often used for returning val ...

  2. python报错 TypeError: a() got multiple values for argument 'name'

    [问题现象] 在一次调用修饰函数中出现了问题,折腾了一下午,一直报错 TypeError:  got multiple values for argument 只是很简单的调用 from tsu2Ru ...

  3. Coroutines in Android - One Shot and Multiple Values

    Coroutines in Android - One Shot and Multiple Values 在Android中, 我们用到的数据有可能是一次性的, 也有可能是需要多个值的. 本文介绍An ...

  4. reverse/inverse a mapping but with multiple values for each key

    reverse/inverse a mapping but with multiple values for each key multi mappping dictionary , reverse/ ...

  5. 跨域:The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed

    https://blog.csdn.net/q646926099/article/details/79082204 使用Ajax跨域请求资源,Nginx作为代理,出现:The 'Access-Cont ...

  6. 跨域The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed.解决方案

    使用Ajax跨域请求资源,Nginx作为代理,出现:The 'Access-Control-Allow-Origin' header contains multiple values '*, *', ...

  7. 【问题解决】'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed.

    问题复述 今天项目组有人找我说之前部署的程序在测试环境没问题,到生产环境出现了奇怪的问题,点按钮没反应. 我通过腾讯会议发现他们的浏览器控制台上打出了如下错误: Access to XMLHttpRe ...

  8. TypeError: test() got multiple values for keyword argument 'key'

    原因是: 1.函数调用的最终形式只会调用两个函数.一个list参数和一个dict参数,格式为call(func, list, dict); 2.如果传入参数中有key参数,那么首先key参数(包括扩展 ...

  9. Python TypeError: __init__() got multiple values for argument 'master'(转)

    转自:https://stackoverflow.com/questions/33153404/python-typeerror-init-got-multiple-values-for-argume ...

随机推荐

  1. How JSP work.

    A JSP page exists in three forms: JSP source code: consists of a mix of HTML template code. Java lan ...

  2. Linux filesystem structures.

    1. / – Root Every single file and directory starts from the root directory. Only root user has write ...

  3. Ajax数据格式,html,xml,json

    1. 2. 3. 4. 5. 6. 7. 8. 9.

  4. iOS GorupBy

    转自:  IOS 数组分组 Grouped NSArray 1 2 3 4 5 6 7 8 NSMutableSet *set=[NSMutableSet set];   [_list enumera ...

  5. Rechability的简单使用

    AppDelegate.m #import "AppDelegate.h" #import "Reachability.h" @interface AppDel ...

  6. Char Varchar Nvarchar区别

    char和varchar是一样的字符型,不同在于,varchar比char更灵活,精确,且不占内存空间,当你取同样的字符时,char会在该字符后面加上空格,而varchar则只取得这个字符,比如有字段 ...

  7. cas sso单点登录系列3_cas-server端配置认证方式实践(数据源+自定义java类认证)

    转:http://blog.csdn.net/ae6623/article/details/8851801 本篇将讲解cas-server端的认证方式 1.最简单的认证,用户名和密码一致就登录成功 2 ...

  8. cocos2dx 3.2中的物理引擎初探(一)

    cocos2dx在设计之初就集成了两套物理引擎,它们是box2d和chipmunk.我目前使用的是最新版的cocos2dx 3.2.引擎中默认使用的是chipmunk,如果想要改使用box2d的话,需 ...

  9. Android之声音管理器《AudioManager》的使用以及音量控制

    以下为网上下载然后拼接-- Android声音管理AudioManager使用 手机都有声音模式,声音.静音还有震动,甚至震动加声音兼备,这些都是手机的基本功能.在Android手机中,我们同样可以通 ...

  10. 支持mdev的init脚本片断

    mount -t tmpfs mdev /dev mount -t sysfs sysfs /sys mkdir /dev/pts mount -t devpts devpts /dev/pts ec ...