unitycatalog_common/models/
functions_ext.rs1use super::functions::v1::{
12 CreateFunction, FunctionParameterInfos, ParameterStyle, RoutineBody, SecurityType,
13 SqlDataAccess,
14};
15
16impl CreateFunction {
17 #[allow(clippy::too_many_arguments)]
22 pub fn new(
23 name: impl Into<String>,
24 catalog_name: impl Into<String>,
25 schema_name: impl Into<String>,
26 data_type: impl Into<String>,
27 full_data_type: impl Into<String>,
28 parameter_style: ParameterStyle,
29 is_deterministic: bool,
30 sql_data_access: SqlDataAccess,
31 is_null_call: bool,
32 security_type: SecurityType,
33 routine_body: RoutineBody,
34 ) -> Self {
35 Self {
36 name: name.into(),
37 catalog_name: catalog_name.into(),
38 schema_name: schema_name.into(),
39 data_type: data_type.into(),
40 full_data_type: full_data_type.into(),
41 parameter_style: buffa::EnumValue::Known(parameter_style),
42 is_deterministic,
43 sql_data_access: buffa::EnumValue::Known(sql_data_access),
44 is_null_call,
45 security_type: buffa::EnumValue::Known(security_type),
46 routine_body: buffa::EnumValue::Known(routine_body),
47 ..Default::default()
48 }
49 }
50
51 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
53 pub fn with_input_params(
54 mut self,
55 input_params: impl Into<Option<FunctionParameterInfos>>,
56 ) -> Self {
57 self.input_params = buffa::MessageField::from(input_params.into());
58 self
59 }
60
61 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
63 pub fn with_properties<I, K, V>(mut self, properties: I) -> Self
64 where
65 I: IntoIterator<Item = (K, V)>,
66 K: Into<String>,
67 V: Into<String>,
68 {
69 self.properties = properties
70 .into_iter()
71 .map(|(k, v)| (k.into(), v.into()))
72 .collect();
73 self
74 }
75}