File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -213,9 +213,11 @@ pub struct UserIdentity {
213213#[ serde( rename_all = "camelCase" ) ]
214214pub struct StreamRecord {
215215 /// 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
217218 #[ serde( rename = "ApproximateCreationDateTime" ) ]
218219 #[ serde( with = "float_unix_epoch" ) ]
220+ #[ serde( default ) ]
219221 pub approximate_creation_date_time : DateTime < Utc > ,
220222 /// The primary key attribute(s) for the DynamoDB item that was modified.
221223 #[ serde( deserialize_with = "deserialize_lambda_dynamodb_item" ) ]
@@ -274,5 +276,7 @@ mod test {
274276 let output: String = serde_json:: to_string ( & parsed) . unwrap ( ) ;
275277 let reparsed: EventRecord = serde_json:: from_slice ( output. as_bytes ( ) ) . unwrap ( ) ;
276278 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) ;
277281 }
278282}
Original file line number Diff line number Diff line change 66 "recordFormat" :" application/json" ,
77 "tableName" :" examples" ,
88 "dynamodb" :{
9- "ApproximateCreationDateTime" :1649809356015 ,
109 "Keys" :{
1110 "id" :{
1211 "S" :" 00000000-0000-0000-0000-000000000000"
You can’t perform that action at this time.
0 commit comments