Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #24 from cipherstash/feat/to-wire-datetime-utc
Browse files Browse the repository at this point in the history
datetime to wire
  • Loading branch information
ragibkl authored Nov 20, 2023
2 parents 04a72f8 + 117cb3d commit fcb2346
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion convergence/src/to_wire.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use bytes::BytesMut;
use chrono::{NaiveDate, NaiveDateTime, NaiveTime};
use chrono::{DateTime, NaiveDate, NaiveDateTime, NaiveTime, Utc};
use postgres_types::ToSql;
use rust_decimal::Decimal;

Expand Down Expand Up @@ -81,6 +81,15 @@ impl ToWire for NaiveTime {
}
}

impl ToWire for DateTime<Utc> {
fn to_binary(&self) -> Vec<u8> {
self.naive_utc().to_binary()
}
fn to_text(&self) -> Vec<u8> {
self.to_rfc3339().as_bytes().into()
}
}

impl ToWire for Decimal {
fn to_binary(&self) -> Vec<u8> {
let mut b = BytesMut::new();
Expand Down

0 comments on commit fcb2346

Please sign in to comment.