File tree 2 files changed +5
-2
lines changed
2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -213,9 +213,11 @@ pub struct UserIdentity {
213
213
#[ serde( rename_all = "camelCase" ) ]
214
214
pub struct StreamRecord {
215
215
/// The approximate date and time when the stream record was created, in UNIX
216
- /// epoch time (http://www.epochconverter.com/) format.
216
+ /// epoch time (http://www.epochconverter.com/) format. Might not be present in
217
+ /// the record: https://github.com/awslabs/aws-lambda-rust-runtime/issues/889
217
218
#[ serde( rename = "ApproximateCreationDateTime" ) ]
218
219
#[ serde( with = "float_unix_epoch" ) ]
220
+ #[ serde( default ) ]
219
221
pub approximate_creation_date_time : DateTime < Utc > ,
220
222
/// The primary key attribute(s) for the DynamoDB item that was modified.
221
223
#[ serde( deserialize_with = "deserialize_lambda_dynamodb_item" ) ]
@@ -274,5 +276,7 @@ mod test {
274
276
let output: String = serde_json:: to_string ( & parsed) . unwrap ( ) ;
275
277
let reparsed: EventRecord = serde_json:: from_slice ( output. as_bytes ( ) ) . unwrap ( ) ;
276
278
assert_eq ! ( parsed, reparsed) ;
279
+ let date = Utc . timestamp_micros ( 0 ) . unwrap ( ) ; // 1970-01-01T00:00:00Z
280
+ assert_eq ! ( date, reparsed. change. approximate_creation_date_time) ;
277
281
}
278
282
}
Original file line number Diff line number Diff line change 6
6
"recordFormat" :" application/json" ,
7
7
"tableName" :" examples" ,
8
8
"dynamodb" :{
9
- "ApproximateCreationDateTime" :1649809356015 ,
10
9
"Keys" :{
11
10
"id" :{
12
11
"S" :" 00000000-0000-0000-0000-000000000000"
You can’t perform that action at this time.
0 commit comments