#database #postgres #postgresql #sql #interval

pg_interval

A native PostgreSQL interval type

2 unstable releases

0.1.0 Mar 10, 2019
0.0.1 Aug 6, 2018

#48 in Date and time

Download history 5/week @ 2018-11-26 4/week @ 2018-12-03 3/week @ 2018-12-10 2/week @ 2018-12-17 6/week @ 2018-12-24 1/week @ 2018-12-31 3/week @ 2019-01-07 1/week @ 2019-01-14 2/week @ 2019-01-28 1/week @ 2019-02-04 2/week @ 2019-02-18 1/week @ 2019-02-25 4/week @ 2019-03-04

10 downloads per month

MIT license

50KB
1.5K SLoC

Build Status codecov

Rust-Postgres-Interval

A interval type for the postgres driver.

Contributing

There is a separate document on how to contribute to this repo here

Overview

Rust-Postgres-Interval is dedicated datatype for the postgres interval type.

extern crate pg_interval;

use pg_interval::Interval;

fn main() {
    let months = 13;
    let days = 1;
    let microseconds = 3600000000;
    let interval = Interval::new(months, days, microseconds);
    let output = interval.to_iso_8601();
    assert_eq!(String::from("P1Y1M1DT1H"), output);
}

Requirements

  • rust 1.22

Roadmap to 1.0.0

  • Convert Interval Into Formated String
    • Iso 8601
    • Postgres
    • Sql
  • Parse Formated Strings Into The Interval Typ
    • Iso 8601
    • Postgres
    • Sql
  • Chrono Integrations

Dependencies

~3MB
~62K SLoC