Closed tanner0101 closed 4 years ago
Adds support for configuring which JSON coders MySQL uses when serializing nested data to the database (#189).
// Setup custom JSON coders that use unix timestamps let encoder = JSONEncoder() encoder.dateEncodingStrategy = .secondsSince1970 let decoder = JSONDecoder() decoder.dateDecodingStrategy = .secondsSince1970 // Configure MySQL database. app.databaes.use(.mysql( configuration: ..., encoder: MySQLDataEncoder(json: encoder), decoder: MySQLDataDecoder(json: decoder) ))
Note that for dates specifically, you can use @Timestamp formats to configure formatting per field.
@Timestamp
Adds changes from https://github.com/vapor/mysql-kit/pull/285
These changes are now available in 4.0.0-rc.2.2
Adds support for configuring which JSON coders MySQL uses when serializing nested data to the database (#189).
Note that for dates specifically, you can use
@Timestamp
formats to configure formatting per field.