Skip to content

Commit

Permalink
Add support for jiff
Browse files Browse the repository at this point in the history
  • Loading branch information
snaggen committed Aug 13, 2024
1 parent b20eeab commit 324779e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ actix-files = ["paperclip-core/actix-files"]
actix3-validator = ["paperclip-core/actix3-validator"]
actix4-validator = ["paperclip-core/actix4-validator"]
chrono = ["paperclip-core/chrono"]
jiff = ["paperclip-core/jiff"]
rust_decimal = ["paperclip-core/rust_decimal"]
url = ["paperclip-core/url"]
uuid = ["uuid0","uuid1"]
Expand Down
1 change: 1 addition & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ actix-session = { version = "0", optional = true }
actix-identity = { version = "0", optional = true }
actix-files = { version = "0", optional = true }
chrono = { version = "0.4", optional = true }
jiff = { version = "0.1.5", optional = true }
heck = { version = "0.4", optional = true }
once_cell = "1.4"
log = { version = "0.4", optional = true }
Expand Down
4 changes: 4 additions & 0 deletions core/src/v2/actix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@ mod manual_impl {
impl_simple!(usize);
#[cfg(feature = "chrono")]
impl_simple!(chrono::NaiveDateTime);
#[cfg(feature = "jiff")]
impl_simple!(jiff::Timestamp);
#[cfg(feature = "jiff")]
impl_simple!(jiff::Zoned);
#[cfg(feature = "rust_decimal")]
impl_simple!(rust_decimal::Decimal);
#[cfg(feature = "url")]
Expand Down
22 changes: 22 additions & 0 deletions core/src/v2/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,28 @@ impl_type_simple!(
DataType::File,
DataTypeFormat::Binary
);
#[cfg(feature = "jiff")]
impl_type_simple!(jiff::Timestamp, DataType::String, DataTypeFormat::DateTime);
#[cfg(feature = "jiff")]
impl_type_simple!(
jiff::Zoned,
DataType::String,
DataTypeFormat::Other //RFC 8536
);
#[cfg(feature = "jiff")]
impl_type_simple!(
jiff::civil::DateTime,
DataType::String,
DataTypeFormat::Other //2024-06-19T15:22:45
);
#[cfg(feature = "jiff")]
impl_type_simple!(jiff::civil::Date, DataType::String, DataTypeFormat::Date);
#[cfg(feature = "jiff")]
impl_type_simple!(
jiff::civil::Time,
DataType::String,
DataTypeFormat::Other //15:22:45
);
#[cfg(feature = "chrono")]
impl_type_simple!(
chrono::NaiveDateTime,
Expand Down

0 comments on commit 324779e

Please sign in to comment.