NSPredicate 查询 Realm 对象
NSPredicate query for a Realm object
有人可以帮我构建一个领域查询来搜索具有特定 entryid 值的视频,为了加分,第二个查询可以通过它们的 entryid 找到两个视频吗?
谢谢!
Video {
nid = 1;
video_title = OK;
video_description = Description {
value = Description;
};
video_kaltura = Kaltura {
entryid = 0_abababa3;
mediatype = 1;
};
}
Video {
nid = 2;
video_title = OK;
video_description = Description {
value = Description;
};
video_kaltura = Kaltura {
entryid = 0_cdcdcdc3;
mediatype = 1;
};
}
我试过类似的东西:
NSPredicate *pred = [NSPredicate predicateWithFormat:@"video_kaltura['entryid'] CONTAINS[c] '0_abababa3'"];
RLMResults *test = [Video objectsWithPredicate:pred];
及其变化无济于事。
NSPredicate
使用关键路径遍历属性(object.someProperty.otherProperty
)。
根据您的示例数据,您需要像 video_kalutra.entryid == '0_abababa3'
.
这样的谓词
有人可以帮我构建一个领域查询来搜索具有特定 entryid 值的视频,为了加分,第二个查询可以通过它们的 entryid 找到两个视频吗?
谢谢!
Video {
nid = 1;
video_title = OK;
video_description = Description {
value = Description;
};
video_kaltura = Kaltura {
entryid = 0_abababa3;
mediatype = 1;
};
}
Video {
nid = 2;
video_title = OK;
video_description = Description {
value = Description;
};
video_kaltura = Kaltura {
entryid = 0_cdcdcdc3;
mediatype = 1;
};
}
我试过类似的东西:
NSPredicate *pred = [NSPredicate predicateWithFormat:@"video_kaltura['entryid'] CONTAINS[c] '0_abababa3'"];
RLMResults *test = [Video objectsWithPredicate:pred];
及其变化无济于事。
NSPredicate
使用关键路径遍历属性(object.someProperty.otherProperty
)。
根据您的示例数据,您需要像 video_kalutra.entryid == '0_abababa3'
.