本文整理汇总了TypeScript中typestore.FinderDescriptor函数的典型用法代码示例。如果您正苦于以下问题:TypeScript FinderDescriptor函数的具体用法?TypeScript FinderDescriptor怎么用?TypeScript FinderDescriptor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FinderDescriptor函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
@CloudSearchFinderDescriptor({
resultType: Object,
resultKeyMapper: DefaultKeyMapper<Object>('id')
})
@FinderDescriptor()
findByTagLineFullText(text:string):Promise<Car[]> {
return null
}
示例2: fn
@IndexedDBFinderDescriptor({
async fn(repo,...args) {
const {table,mapper,db} = repo
const jsons = await table.where('name').equalsIgnoreCase(args[0]).toArray()
return jsons.map(json => mapper.fromObject(json))
}
})
@FinderDescriptor()
findByName(name:string):Promise<IDBModel1[]> {
return null
}
示例3: filter
@IndexedDBFinderDescriptor({
filter(o,...args) {
const txt = o.randomText || ""
const q = args[0] || ''
return txt.length > 0 &&
txt.toLowerCase().indexOf(q.toLowerCase()) > -1
}
})
@FinderDescriptor()
findByRandomTest(text:string):Promise<IDBModel1[]> {
return null
}
示例4: function
@DynamoDBFinderDescriptor({
queryExpression: "randomText = :randomText",
index: 'RandomTextIndex',
// values could be ['randomText'] with the same effect
values: function(...args) {
return {
':randomText': args[0]
}
}
})
@FinderDescriptor()
findByRandomText(text:string):Promise<Test1[]> {
return null
}
示例5: function
// This decoration must come before @FinderDescriptor
// simply specifies details and options specifically for
// Dynamo DB's finder implementation - any store/plugin
// can still implement this, and have other decorations
// as well
@DynamoDBFinderDescriptor({
queryExpression: "tagLine = :tagLine",
index: 'TagLineIndex',
// values could be ['tagLine'] with the same effect
// values can be Array<string> or Function
values: function(...args) {
return {
':tagLine': args[0]
}
}
})
// Mark it as a finder
@FinderDescriptor()
findByTagLine(text:string):Promise<Car[]> {
//Empty implementation - it's implemented
//when the repo is initialized - anything
//in here is lost
return null
}
示例6: FinderDescriptor
(opts:IPouchDBMangoFinderOptions) => FinderDescriptor(opts)