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
32
33
34
35
36
use crate::list::PgList;
use crate::pg_sys;
pub struct PgQualifiedNameBuilder {
list: PgList<pg_sys::Value>,
}
impl Default for PgQualifiedNameBuilder {
fn default() -> Self {
Self::new()
}
}
impl PgQualifiedNameBuilder {
pub fn new() -> PgQualifiedNameBuilder {
PgQualifiedNameBuilder {
list: PgList::<pg_sys::Value>::new(),
}
}
pub fn push(mut self, value: &str) -> PgQualifiedNameBuilder {
self.list
.push(unsafe { pg_sys::makeString(std::ffi::CString::new(value).unwrap().into_raw()) });
self
}
pub fn get_operator_oid(self, lhs_type: pg_sys::Oid, rhs_type: pg_sys::Oid) -> pg_sys::Oid {
unsafe { pg_sys::OpernameGetOprid(self.list.into_pg(), lhs_type, rhs_type) }
}
}