@@ -13,6 +13,9 @@ use chrono::{DateTime, FixedOffset, Local, NaiveDate, NaiveDateTime, NaiveTime,
1313#[ cfg( feature = "with-time" ) ]
1414use time:: { OffsetDateTime , PrimitiveDateTime } ;
1515
16+ #[ cfg( feature = "jiff" ) ]
17+ use jiff:: { Timestamp , Zoned } ;
18+
1619#[ cfg( feature = "with-rust_decimal" ) ]
1720use rust_decimal:: Decimal ;
1821
@@ -62,6 +65,10 @@ pub mod time_format;
6265#[ cfg_attr( docsrs, doc( cfg( feature = "with-time" ) ) ) ]
6366mod with_time;
6467
68+ #[ cfg( feature = "jiff" ) ]
69+ #[ cfg_attr( docsrs, doc( cfg( feature = "jiff" ) ) ) ]
70+ pub ( crate ) mod with_jiff;
71+
6572#[ cfg( feature = "with-rust_decimal" ) ]
6673#[ cfg_attr( docsrs, doc( cfg( feature = "with-rust_decimal" ) ) ) ]
6774mod with_rust_decimal;
@@ -152,6 +159,26 @@ pub enum ArrayType {
152159 #[ cfg_attr( docsrs, doc( cfg( feature = "with-time" ) ) ) ]
153160 TimeDateTimeWithTimeZone ,
154161
162+ #[ cfg( feature = "jiff" ) ]
163+ #[ cfg_attr( docsrs, doc( cfg( feature = "jiff" ) ) ) ]
164+ JiffDate ,
165+
166+ #[ cfg( feature = "jiff" ) ]
167+ #[ cfg_attr( docsrs, doc( cfg( feature = "jiff" ) ) ) ]
168+ JiffTime ,
169+
170+ #[ cfg( feature = "jiff" ) ]
171+ #[ cfg_attr( docsrs, doc( cfg( feature = "jiff" ) ) ) ]
172+ JiffDateTime ,
173+
174+ #[ cfg( feature = "jiff" ) ]
175+ #[ cfg_attr( docsrs, doc( cfg( feature = "jiff" ) ) ) ]
176+ JiffTimestamp ,
177+
178+ #[ cfg( feature = "jiff" ) ]
179+ #[ cfg_attr( docsrs, doc( cfg( feature = "jiff" ) ) ) ]
180+ JiffZoned ,
181+
155182 #[ cfg( feature = "with-uuid" ) ]
156183 #[ cfg_attr( docsrs, doc( cfg( feature = "with-uuid" ) ) ) ]
157184 Uuid ,
@@ -243,6 +270,26 @@ pub enum Value {
243270 #[ cfg_attr( docsrs, doc( cfg( feature = "with-time" ) ) ) ]
244271 TimeDateTimeWithTimeZone ( Option < OffsetDateTime > ) ,
245272
273+ #[ cfg( feature = "jiff" ) ]
274+ #[ cfg_attr( docsrs, doc( cfg( feature = "jiff" ) ) ) ]
275+ JiffDate ( Option < jiff:: civil:: Date > ) ,
276+
277+ #[ cfg( feature = "jiff" ) ]
278+ #[ cfg_attr( docsrs, doc( cfg( feature = "jiff" ) ) ) ]
279+ JiffTime ( Option < jiff:: civil:: Time > ) ,
280+
281+ #[ cfg( feature = "jiff" ) ]
282+ #[ cfg_attr( docsrs, doc( cfg( feature = "jiff" ) ) ) ]
283+ JiffDateTime ( Option < jiff:: civil:: DateTime > ) ,
284+
285+ #[ cfg( feature = "jiff" ) ]
286+ #[ cfg_attr( docsrs, doc( cfg( feature = "jiff" ) ) ) ]
287+ JiffTimestamp ( Option < Timestamp > ) ,
288+
289+ #[ cfg( feature = "jiff" ) ]
290+ #[ cfg_attr( docsrs, doc( cfg( feature = "jiff" ) ) ) ]
291+ JiffZoned ( Option < Zoned > ) ,
292+
246293 #[ cfg( feature = "with-uuid" ) ]
247294 #[ cfg_attr( docsrs, doc( cfg( feature = "with-uuid" ) ) ) ]
248295 Uuid ( Option < Uuid > ) ,
@@ -279,8 +326,8 @@ pub enum Value {
279326pub const VALUE_SIZE : usize = check_value_size ( ) ;
280327
281328const fn check_value_size ( ) -> usize {
282- if std:: mem:: size_of :: < Value > ( ) > 32 {
283- panic ! ( "the size of Value shouldn't be greater than 32 bytes" )
329+ if std:: mem:: size_of :: < Value > ( ) > 120 {
330+ panic ! ( "the size of Value shouldn't be greater than 120 bytes" )
284331 }
285332 std:: mem:: size_of :: < Value > ( )
286333}
@@ -374,6 +421,26 @@ impl Value {
374421 #[ cfg_attr( docsrs, doc( cfg( feature = "with-time" ) ) ) ]
375422 Self :: TimeDateTimeWithTimeZone ( _) => Self :: TimeDateTimeWithTimeZone ( None ) ,
376423
424+ #[ cfg( feature = "jiff" ) ]
425+ #[ cfg_attr( docsrs, doc( cfg( feature = "jiff" ) ) ) ]
426+ Self :: JiffDate ( _) => Self :: JiffDate ( None ) ,
427+
428+ #[ cfg( feature = "jiff" ) ]
429+ #[ cfg_attr( docsrs, doc( cfg( feature = "jiff" ) ) ) ]
430+ Self :: JiffTime ( _) => Self :: JiffTime ( None ) ,
431+
432+ #[ cfg( feature = "jiff" ) ]
433+ #[ cfg_attr( docsrs, doc( cfg( feature = "jiff" ) ) ) ]
434+ Self :: JiffDateTime ( _) => Self :: JiffDateTime ( None ) ,
435+
436+ #[ cfg( feature = "jiff" ) ]
437+ #[ cfg_attr( docsrs, doc( cfg( feature = "jiff" ) ) ) ]
438+ Self :: JiffTimestamp ( _) => Self :: JiffTimestamp ( None ) ,
439+
440+ #[ cfg( feature = "jiff" ) ]
441+ #[ cfg_attr( docsrs, doc( cfg( feature = "jiff" ) ) ) ]
442+ Self :: JiffZoned ( _) => Self :: JiffZoned ( None ) ,
443+
377444 #[ cfg( feature = "with-uuid" ) ]
378445 #[ cfg_attr( docsrs, doc( cfg( feature = "with-uuid" ) ) ) ]
379446 Self :: Uuid ( _) => Self :: Uuid ( None ) ,
@@ -478,6 +545,30 @@ impl Value {
478545 Self :: TimeDateTimeWithTimeZone ( Some ( OffsetDateTime :: UNIX_EPOCH ) )
479546 }
480547
548+ #[ cfg( feature = "jiff" ) ]
549+ #[ cfg_attr( docsrs, doc( cfg( feature = "jiff" ) ) ) ]
550+ Self :: JiffDate ( _) => Self :: JiffDate ( Some ( jiff:: civil:: date ( 1970 , 1 , 1 ) ) ) ,
551+
552+ #[ cfg( feature = "jiff" ) ]
553+ #[ cfg_attr( docsrs, doc( cfg( feature = "jiff" ) ) ) ]
554+ Self :: JiffTime ( _) => Self :: JiffTime ( Some ( jiff:: civil:: time ( 0 , 0 , 0 , 0 ) ) ) ,
555+
556+ #[ cfg( feature = "jiff" ) ]
557+ #[ cfg_attr( docsrs, doc( cfg( feature = "jiff" ) ) ) ]
558+ Self :: JiffDateTime ( _) => {
559+ Self :: JiffDateTime ( Some ( jiff:: civil:: date ( 1970 , 1 , 1 ) . at ( 0 , 0 , 0 , 0 ) ) )
560+ }
561+
562+ #[ cfg( feature = "jiff" ) ]
563+ #[ cfg_attr( docsrs, doc( cfg( feature = "jiff" ) ) ) ]
564+ Self :: JiffTimestamp ( _) => Self :: JiffTimestamp ( Some ( Timestamp :: UNIX_EPOCH ) ) ,
565+
566+ #[ cfg( feature = "jiff" ) ]
567+ #[ cfg_attr( docsrs, doc( cfg( feature = "jiff" ) ) ) ]
568+ Self :: JiffZoned ( _) => Self :: JiffZoned ( Some (
569+ Timestamp :: UNIX_EPOCH . to_zoned ( jiff:: tz:: TimeZone :: UTC ) ,
570+ ) ) ,
571+
481572 #[ cfg( feature = "with-uuid" ) ]
482573 #[ cfg_attr( docsrs, doc( cfg( feature = "with-uuid" ) ) ) ]
483574 Self :: Uuid ( _) => Self :: Uuid ( Some ( Default :: default ( ) ) ) ,
0 commit comments