hank_types/
hank.database.rs1#[derive(Clone, PartialEq, ::prost::Message)]
5pub struct Results {
6 #[prost(string, repeated, tag="1")]
8 pub rows: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
9}
10#[cfg_attr(feature = "builder", derive(derive_builder::Builder))]
12#[cfg_attr(feature = "builder", builder(default, setter(into, strip_option), custom_constructor, build_fn(name = "fallible_build")))]
13#[derive(Clone, PartialEq, ::prost::Message)]
14pub struct PreparedStatement {
15 #[prost(string, tag="1")]
20 pub sql: ::prost::alloc::string::String,
21 #[prost(string, repeated, tag="2")]
23 #[cfg_attr(feature = "builder", builder(setter(custom)))]
24 pub values: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
25}
26#[cfg(feature = "builder")]
29impl PreparedStatement {
30 pub fn new(sql: impl Into<String>) -> PreparedStatementBuilder {
31 PreparedStatementBuilder {
32 sql: Some(sql.into()),
33 ..PreparedStatementBuilder::create_empty()
34 }
35 }
36}
37#[cfg(feature = "builder")]
38impl PreparedStatementBuilder {
39 pub fn values(&mut self, value: impl IntoIterator<Item = impl Into<String>>) -> &mut Self {
40 self.values = Some(value.into_iter().map(Into::into).collect());
41 self
42 }
43 pub fn build(&self) -> PreparedStatement {
44 self.fallible_build()
45 .expect("All required fields were initialized")
46 }
47}