drasi_postgres_common/lib.rs
1// Copyright 2025 The Drasi Authors.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Shared PostgreSQL type conversion for Drasi source and bootstrap plugins.
16//!
17//! Both the CDC source and the bootstrap provider convert column values through
18//! [`PostgresValue::to_element_value`] so snapshot and live rows emit identical
19//! [`drasi_core::models::ElementValue`]s.
20
21#![allow(unexpected_cfgs)]
22
23pub mod decode;
24pub mod oid;
25pub mod value;
26
27pub use decode::{
28 decode_column_value_text, decode_text_to_element_value, decode_text_to_postgres_value,
29 string_element,
30};
31pub use oid::{
32 array_element_oid, is_array_oid, oid_from_information_schema, BOOL, BYTEA, CHAR, DATE, FLOAT4,
33 FLOAT8, INT2, INT4, INT8, JSON, JSONB, NAME, NUMERIC, TEXT, TIME, TIMESTAMP, TIMESTAMPTZ, UUID,
34 VARCHAR,
35};
36pub use value::{encode_base64, parse_bytea_text, PostgresValue};