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
+12-10Lines changed: 12 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -109,6 +109,7 @@ Simple Type (no decorators required to work)
109
109
- Boolean
110
110
- Null
111
111
- Array
112
+
- String/Number Enum
112
113
113
114
Complex Types (properties with these types need some decorators to work properly)
114
115
- Set<simpleType | complexType>
@@ -130,7 +131,8 @@ Complex Types (properties with these types need some decorators to work properly
130
131
| Date | Not Supported |
131
132
132
133
## Custom Attribute Mapping
133
-
It is always possible to define a custom mapping strategy, just implement the [MapperForType](https://shiftcode.github.io/dynamo-easy/interfaces/_mapper_for_type_base_mapper_.mapperfortype.html) class.
134
+
It is always possible to define a custom mapping strategy,
135
+
just implement the [MapperForType](https://shiftcode.github.io/dynamo-easy/interfaces/_mapper_for_type_base_mapper_.mapperfortype.html) and provide with the CustomMapper directive.
134
136
135
137
## Collection Mapping (Array & Set)
136
138
@@ -152,39 +154,38 @@ We only support the native Date type and you need to explicitly mark a property
152
154
(which is basically just syntactic sugar for @CustomMapper(TheDateMapper)).\
153
155
If you want to use a different type for the @Date decorator (eg. Moment) you need to define a custom mapper and provide it to the dynamo easy config like this:\
thrownewError(`the value ${value} cannot be parsed into a valid moment date`)
169
170
}
170
171
returnparsed
171
-
}
172
+
},
172
173
173
-
toDb(value:moment.Moment):StringAttribute {
174
+
toDb: (value:moment.Moment)=> {
174
175
if (!moment.isMoment(value)) {
175
176
thrownewError(`the value ${value} is not of type moment`)
176
177
}
177
178
if (!value.isValid()) {
178
179
thrownewError(`cannot map property value ${value}, because it is not a valid moment date`)
179
180
}
180
181
return { S: value.clone().utc().format() }
181
-
}
182
+
},
182
183
}
183
184
```
184
185
185
186
186
187
## Enum
187
-
Enum values are persisted as Numbers (index of enum).
188
+
Enum values are persisted as Numbers (index of enum) or string if string value was given.
188
189
189
190
# Request API
190
191
To start making requests create an instance of [DynamoStore](https://shiftcode.github.io/dynamo-easy/classes/_dynamo_dynamo_store_.dynamostore.html) and execute the desired operation using the provided api.
@@ -196,7 +197,8 @@ We support the following dynamodb operations with a fluent api:
196
197
- Delete
197
198
- Scan
198
199
- Query
199
-
- BatchGet
200
+
- BatchGet (from a single table)
201
+
- BatchWrite (to a single table)
200
202
- MakeRequest (generic low level method for special scenarios)
201
203
202
204
There is always the possibility to access the Params object directly to add values which are not covered with our api.
0 commit comments