mirror of
https://github.com/flibusta-apps/book_library_server.git
synced 2025-12-06 15:15:36 +01:00
Move to sqlx
This commit is contained in:
16
src/serializers/date.rs
Normal file
16
src/serializers/date.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
use chrono::NaiveDate;
|
||||
use serde::Serializer;
|
||||
|
||||
const FORMAT: &str = "%Y-%m-%d";
|
||||
|
||||
pub mod naive_date_serializer {
|
||||
use super::*;
|
||||
|
||||
pub fn serialize<S>(date: &NaiveDate, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
let formatted_date = date.format(FORMAT).to_string();
|
||||
serializer.serialize_str(&formatted_date)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user