You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,9 @@ Code transformer plugin for Amazon DynamoDB attributes powered by [TypeScript Co
4
4
5
5
## How it works
6
6
7
-
This plugin replaces the TypeScript function invocation of `dynamodbRecord<T>(obj: T)` with `Record<string, AttributeValue>` value that is defined in aws-sdk-js-v3 according to the type `T` and the contents of the object. In short, this plugin generates the DynamoDB attribute code for every property of type `T`.
7
+
This plugin replaces the TypeScript function invocation of `dynamodbRecord<T>(obj: T)` with `Record<keyof T, AttributeValue>` value that is defined in aws-sdk-js-v3 according to the type `T` and the contents of the object. In short, this plugin generates the DynamoDB attribute code for every property of type `T`.
8
8
9
-
This plugin powers the users can do drop-in replacements for the existing `Record<string, AttributeValue>` value and/or the generator with `dynamodbRecord<T>(obj: T)` function.
9
+
This plugin powers the users can do drop-in replacements for the existing `Record<keyof T, AttributeValue>` value and/or the generator with `dynamodbRecord<T>(obj: T)` function.
10
10
11
11
Manual making the translation layer between the object and DynamoDB's Record is no longer needed!
* Then you can use this record value on the aws-sdk-js-v3's DynamoDB client; for example,
41
-
*
41
+
*
42
42
* const dyn = new DynamoDBClient(...);
43
43
* await dyn.send(new PutItemCommand({
44
44
* TableName: "...",
@@ -81,7 +81,7 @@ const record = function () {
81
81
}();
82
82
/*
83
83
* This record is equal to the following object:
84
-
*
84
+
*
85
85
* {
86
86
* id: { N: "12345" },
87
87
* name: { S: "John Doe" },
@@ -97,11 +97,11 @@ const record = function () {
97
97
98
98
## How to use this transformer
99
99
100
-
This plugin exports a function that has the signature `dynamodbRecord<T extends object>(item: T): Record<string, AttributeValue>`.
100
+
This plugin exports a function that has the signature `dynamodbRecord<T extends object>(item: T): Record<keyof T, AttributeValue>`.
101
101
102
-
This function is a marker to indicate to the transformer to replace this function invocation with the generated DynamoDB record code. Therefore, there are some restrictions:
102
+
This function is a marker to indicate to the transformer to replace this function invocation with the generated DynamoDB record code. Therefore, there are some restrictions:
103
103
104
-
- Type parameter `T` is mandatory parameter (i.e. this mustn't be omitted). A transformer analyzes the type of the given `T` to collect the property information.
104
+
- Type parameter `T` is mandatory parameter (i.e. this mustn't be omitted). A transformer analyzes the type of the given `T` to collect the property information.
0 commit comments