Skip to content

Commit

Permalink
started typing query and scan
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierlefevre committed May 17, 2020
1 parent 5cb29ca commit c0b4018
Showing 1 changed file with 48 additions and 3 deletions.
51 changes: 48 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//
// Improvements:
// 1. Type Table methods parameters and returns
// 1bis. Improve sortKey typing and impact on gt, lt, etc.
// 2. Separate this file in several for better code understanding
// 3. Improve input/output to methods thanks to "Schema"
// 4. Improve complex "key" type from update and delete methods
Expand Down Expand Up @@ -37,12 +38,52 @@ declare module "dynamodb-toolbox" {
delete(entity, key, options?, parameters?);
put(entity, item, options?, parameters?);
update(entity, key, options?, parameters?);
query(partitionKey, options?, parameters?);
scan(options?, parameters?);
query(
partitionKey: string,
options?: QueryInputOptions,
parameters?
): Promise<any>;
scan(options?: ScanInputOptions, parameters?): Promise<any>;
batchWrite(items, options?, parameters?);
batchGet(items, options?, parameters?);
}

interface ScanInputOptions {
index?: string;
limit?: number;
consistent?: boolean;
capacity: string;
select: string;
filters?: {} | [];
attributes?: {} | [];
startKey?: {};
segments?: number;
segment?: number;
entity?: string;
autoExecute?: boolean;
autoParse?: boolean;
}
interface QueryInputOptions {
index?: string;
limit?: number;
reverse?: boolean;
consistent?: boolean;
capacity?: string;
select?: string;
eq?: string;
lt?: string;
lte?: string;
gt?: string;
gte?: string;
between?: [string, string];
beginsWith?: string;
filters?: {} | [];
attributes?: {} | [];
startKey?: {};
entity?: string;
autoExecute?: boolean;
autoParse?: boolean;
}
interface SchemaBase {
entity: string;
created: string;
Expand Down Expand Up @@ -130,7 +171,11 @@ declare module "dynamodb-toolbox" {
},
parameters?
): Promise<UpdateOutput<Schema>>;
query(partionKey, options?, parameters?);
query(
partitionKey: string,
options?: QueryInputOptions,
parameters?
): Promise<any>;
scan(options?, parameters?);
}

Expand Down

0 comments on commit c0b4018

Please sign in to comment.