pg_interval

A native PostgreSQL interval type

7 releases (4 breaking)

0.4.2 Oct 20, 2022
0.4.1 Feb 23, 2022
0.3.0 May 5, 2019
0.2.0 Apr 1, 2019
0.0.1 Aug 6, 2018

#437 in Database interfaces

Download history 1398/week @ 2024-06-17 1289/week @ 2024-06-24 1649/week @ 2024-07-01 1523/week @ 2024-07-08 1515/week @ 2024-07-15 1226/week @ 2024-07-22 1007/week @ 2024-07-29 1349/week @ 2024-08-05 1543/week @ 2024-08-12 1539/week @ 2024-08-19 1300/week @ 2024-08-26 1471/week @ 2024-09-02 1390/week @ 2024-09-09 1423/week @ 2024-09-16 2326/week @ 2024-09-23 1689/week @ 2024-09-30

6,859 downloads per month
Used in 3 crates (2 directly)

MIT license

67KB
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 interval = Interval::from_postgres(
        "1 years 1 months 1 days 1 hours"
    ).unwrap();
    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 Type
    • Iso 8601
    • Postgres
    • Sql
  • Chrono Integrations

Dependencies

~1–1.8MB
~32K SLoC