1use crate::arguments::{PgArgumentBuffer, PgArguments};
2use rbdc::Error;
3use rbs::Value;
4
5pub enum IsNull {
6 No,
7 Yes,
8}
9
10pub trait Encode {
11 fn encode(self, buf: &mut PgArgumentBuffer) -> Result<IsNull, Error>;
12}
13
14impl PgArguments {
15 pub fn from_args(args: Vec<Value>, timezone_sec: Option<i32>) -> Result<Self, Error> {
16 let mut arg = PgArguments {
17 types: Vec::with_capacity(args.len()),
18 buffer: {
19 let mut buf = PgArgumentBuffer::default();
20 buf.timezone_sec = timezone_sec;
21 buf
22 },
23 };
24 for x in args {
25 arg.add(x)?;
26 }
27 Ok(arg)
28 }
29}