本文整理匯總了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)