1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#![deny(missing_debug_implementations)]
#![allow(dead_code)]
mod parser;
pub mod table;
pub use postgres_types::Type as PgType;
pub fn oid_typlen(pg_type: PgType) -> i16 {
match pg_type {
PgType::BOOL => 1,
PgType::BYTEA => -1,
PgType::CHAR => 1,
PgType::INT8 => 8,
PgType::INT2 => 2,
PgType::INT2_VECTOR => -1,
PgType::INT4 => 4,
PgType::TEXT => -1,
PgType::FLOAT4 => 4,
PgType::FLOAT8 => 8,
PgType::VARCHAR => -1,
PgType::DATE => 4,
PgType::TIME => 8,
PgType::TIMESTAMP => 8,
PgType::TIMESTAMPTZ => 8,
PgType::TIMETZ => 12,
PgType::BIT => -1,
PgType::JSONB => -1,
_ => panic!("unknown pg_type:{}", pg_type),
}
}