use super::functions::v1::{
CreateFunction, FunctionParameterInfos, ParameterStyle, RoutineBody, SecurityType,
SqlDataAccess,
};
impl CreateFunction {
#[allow(clippy::too_many_arguments)]
pub fn new(
name: impl Into<String>,
catalog_name: impl Into<String>,
schema_name: impl Into<String>,
data_type: impl Into<String>,
full_data_type: impl Into<String>,
parameter_style: ParameterStyle,
is_deterministic: bool,
sql_data_access: SqlDataAccess,
is_null_call: bool,
security_type: SecurityType,
routine_body: RoutineBody,
) -> Self {
Self {
name: name.into(),
catalog_name: catalog_name.into(),
schema_name: schema_name.into(),
data_type: data_type.into(),
full_data_type: full_data_type.into(),
parameter_style: buffa::EnumValue::Known(parameter_style),
is_deterministic,
sql_data_access: buffa::EnumValue::Known(sql_data_access),
is_null_call,
security_type: buffa::EnumValue::Known(security_type),
routine_body: buffa::EnumValue::Known(routine_body),
..Default::default()
}
}
#[must_use = "with_* setters return `self` by value; assign or chain the result"]
pub fn with_input_params(
mut self,
input_params: impl Into<Option<FunctionParameterInfos>>,
) -> Self {
self.input_params = buffa::MessageField::from(input_params.into());
self
}
#[must_use = "with_* setters return `self` by value; assign or chain the result"]
pub fn with_properties<I, K, V>(mut self, properties: I) -> Self
where
I: IntoIterator<Item = (K, V)>,
K: Into<String>,
V: Into<String>,
{
self.properties = properties
.into_iter()
.map(|(k, v)| (k.into(), v.into()))
.collect();
self
}
}