本文整理汇总了TypeScript中backendless.Persistence类的典型用法代码示例。如果您正苦于以下问题:TypeScript Persistence类的具体用法?TypeScript Persistence怎么用?TypeScript Persistence使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Persistence类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getTagByName
getTagByName(name: string): Promise<Tag> {
let query = new Backendless.DataQuery();
query.condition = "name='" + name + "'";
return Backendless.Persistence.of(Tag).find(query)
.then(res=>{
if(!res.data.length) throw new Error('Tag with such name isn\'t existed');
return res;
});
}
示例2: getDisplayTag
getDisplayTag(place:Place, tag: Tag) {
let query = new Backendless.DataQuery();
query.condition = "place.objectId='" + place.objectId + "' and tag.objectId='" + tag.objectId + "'";
return Backendless.Persistence.of(Likes).find(query)
.then(res=>{
let dispTag = new DisplayTag(tag, res.totalObjects);
console.log("getDisplayTag:");
console.log(dispTag);
return dispTag;
});
}
示例3: getLikedTags
getLikedTags(placeID:string) {
let query = new Backendless.DataQuery();
query.condition = "place.objectId='" + placeID + "'";
query.options = { relations: ["tag"] };
return Backendless.Persistence.of(Likes).find(query).
then(res => res.data.map((like) => like.tag))
.then(tags => {
let displayTags = [];
let tagsCount = _.groupBy(tags, "objectId");
for (let key in tagsCount) {
displayTags.push(new DisplayTag(tagsCount[key][0], tagsCount[key].length))
}
return displayTags;
});
}
示例4: Tag
err=>{
let tag = new Tag();
tag.name = tagName;
return Backendless.Persistence.of(Tag).save(tag);}
示例5: Likes
.then(user=>{
let like = new Likes(place, user, tag);
return Backendless.Persistence.of(Likes).save(like);
});
示例6: search
search(term:string) {
var tagStorage = Backendless.Persistence.of(Tag);
var dataQuery = new Backendless.DataQuery();
dataQuery.condition = "name LIKE '%" + term + "%'";
return tagStorage.find( dataQuery );
}