@pgtyped/query
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -6,8 +6,15 @@ interface IDatabaseConnection { | ||
} | ||
export declare class TaggedQuery<TResult, TParams> { | ||
run: (params: TParams, dbConnection: IDatabaseConnection) => Promise<TResult[]>; | ||
export declare class TaggedQuery<TTypePair extends { | ||
params: any; | ||
result: any; | ||
}> { | ||
run: (params: TTypePair["params"], dbConnection: IDatabaseConnection) => Promise<TTypePair["result"]>; | ||
private query; | ||
constructor(query: string); | ||
} | ||
declare const sql: <TResult, TParams>(stringsArray: TemplateStringsArray) => TaggedQuery<TResult, TParams>; | ||
interface ITypePair { | ||
params: any; | ||
result: any; | ||
} | ||
declare const sql: <TTypePair extends ITypePair>(stringsArray: TemplateStringsArray) => TaggedQuery<TTypePair>; | ||
export default sql; |
{ | ||
"name": "@pgtyped/query", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"main": "lib/index.js", | ||
@@ -25,7 +25,7 @@ "types": "lib/index.d.ts", | ||
"dependencies": { | ||
"@pgtyped/wire": "^0.3.0", | ||
"@pgtyped/wire": "^0.4.0", | ||
"@types/debug": "^4.1.4", | ||
"debug": "^4.1.1" | ||
}, | ||
"gitHead": "e898a73247c2a8f871623177bcd9b63f7071f6ae" | ||
"gitHead": "6227605fa3e98c6c53fe959cfe10911512537a55" | ||
} |
@@ -10,7 +10,7 @@ import processQuery, { | ||
export class TaggedQuery<TResult, TParams> { | ||
export class TaggedQuery<TTypePair extends {params: any, result: any}> { | ||
public run: ( | ||
params: TParams, | ||
params: TTypePair["params"], | ||
dbConnection: IDatabaseConnection, | ||
) => Promise<TResult[]>; | ||
) => Promise<TTypePair["result"]>; | ||
@@ -32,6 +32,11 @@ private query: string; | ||
const sql = <TResult, TParams>(stringsArray: TemplateStringsArray) => ( | ||
new TaggedQuery<TResult, TParams>(stringsArray[0]) | ||
interface ITypePair { | ||
params: any; | ||
result: any; | ||
} | ||
const sql = <TTypePair extends ITypePair>(stringsArray: TemplateStringsArray) => ( | ||
new TaggedQuery<TTypePair>(stringsArray[0]) | ||
); | ||
export default sql; |
Sorry, the diff of this file is not supported yet
67934
1400
+ Added@pgtyped/wire@0.4.5(transitive)
- Removed@pgtyped/wire@0.3.0(transitive)
Updated@pgtyped/wire@^0.4.0