Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for jiff #526

Merged
merged 2 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]
jiff01 = ["paperclip-core/jiff01"]
rust_decimal = ["paperclip-core/rust_decimal"]
url = ["paperclip-core/url"]
uuid = ["uuid0","uuid1"]
Expand Down
2 changes: 2 additions & 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 Expand Up @@ -47,6 +48,7 @@ actix2 = ["actix-base", "actix-web2"]
actix-base = ["v2", "pin-project-lite"]
actix3-validator = ["actix-web-validator2", "validator12"]
actix4-validator = ["actix-web-validator3", "validator14"]
jiff01 = ["jiff"]

# Enable nightly if nightly compiler can be allowed
nightly = ["paperclip-macros/nightly"]
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 = "jiff01")]
impl_simple!(jiff::Timestamp);
#[cfg(feature = "jiff01")]
impl_simple!(jiff::Zoned);
#[cfg(feature = "rust_decimal")]
impl_simple!(rust_decimal::Decimal);
#[cfg(feature = "url")]
Expand Down
28 changes: 28 additions & 0 deletions core/src/v2/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,34 @@ impl_type_simple!(
DataType::File,
DataTypeFormat::Binary
);
#[cfg(feature = "jiff01")]
impl_type_simple!(jiff::Timestamp, DataType::String, DataTypeFormat::DateTime);
#[cfg(feature = "jiff01")]
impl_type_simple!(
jiff::Zoned,
DataType::String,
DataTypeFormat::Other //RFC 8536
);
#[cfg(feature = "jiff01")]
impl_type_simple!(
jiff::civil::DateTime,
DataType::String,
DataTypeFormat::Other //2024-06-19T15:22:45
);
#[cfg(feature = "jiff01")]
impl_type_simple!(jiff::civil::Date, DataType::String, DataTypeFormat::Date);
#[cfg(feature = "jiff01")]
impl_type_simple!(
jiff::civil::Time,
DataType::String,
DataTypeFormat::Other //15:22:45
);
#[cfg(feature = "jiff01")]
impl_type_simple!(
jiff::Span,
DataType::String,
DataTypeFormat::Other //ISO 8601
);
#[cfg(feature = "chrono")]
impl_type_simple!(
chrono::NaiveDateTime,
Expand Down
Loading