Skip to content
Closed
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
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
version: '2'
services:
postgres:
image: "sfackler/rust-postgres-test:6"
image: "sfackler/rust-postgres-test:7"
build: ./docker
environment:
- POSTGRES_PASSWORD=password
ports:
- 5433:5433
2 changes: 2 additions & 0 deletions docker/sql_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ port = 5433
ssl = on
ssl_cert_file = 'server.crt'
ssl_key_file = 'server.key'
wal_level = logical
EOCONF

cat > "$PGDATA/pg_hba.conf" <<-EOCONF
Expand All @@ -82,6 +83,7 @@ host all ssl_user ::0/0 reject

# IPv4 local connections:
host all postgres 0.0.0.0/0 trust
host replication postgres 0.0.0.0/0 trust
# IPv6 local connections:
host all postgres ::0/0 trust
# Unix socket connections:
Expand Down
1 change: 1 addition & 0 deletions postgres-protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ byteorder = "1.0"
bytes = "1.0"
fallible-iterator = "0.2"
hmac = "0.10"
lazy_static = "1.4"
md-5 = "0.9"
memchr = "2.0"
rand = "0.8"
Expand Down
7 changes: 7 additions & 0 deletions postgres-protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

use byteorder::{BigEndian, ByteOrder};
use bytes::{BufMut, BytesMut};
use lazy_static::lazy_static;
use std::io;
use std::time::{Duration, SystemTime, UNIX_EPOCH};

pub mod authentication;
pub mod escape;
Expand All @@ -28,6 +30,11 @@ pub type Oid = u32;
/// A Postgres Log Sequence Number (LSN).
pub type Lsn = u64;

lazy_static! {
/// Postgres epoch is 2000-01-01T00:00:00Z
pub static ref PG_EPOCH: SystemTime = UNIX_EPOCH + Duration::from_secs(946_684_800);
}

/// An enum indicating if a value is `NULL` or not.
pub enum IsNull {
/// The value is `NULL`.
Expand Down
Loading