unitycatalog_client/codegen/functions/
resource.rs1#![allow(unused_imports)]
3use super::builders::*;
4use super::client::FunctionServiceClient;
5use unitycatalog_common::models::functions::v1::*;
6#[derive(Clone)]
8pub struct FunctionClient {
9 pub(crate) catalog_name: String,
10 pub(crate) schema_name: String,
11 pub(crate) function_name: String,
12 pub(crate) client: FunctionServiceClient,
13}
14impl FunctionClient {
15 pub fn new(
17 catalog_name: impl Into<String>,
18 schema_name: impl Into<String>,
19 function_name: impl Into<String>,
20 client: FunctionServiceClient,
21 ) -> Self {
22 Self {
23 catalog_name: catalog_name.into(),
24 schema_name: schema_name.into(),
25 function_name: function_name.into(),
26 client,
27 }
28 }
29 pub fn from_full_name(full_name: impl Into<String>, client: FunctionServiceClient) -> Self {
31 let full_name = full_name.into();
32 let mut parts = full_name.splitn(3usize, '.');
33 let catalog_name = parts.next().unwrap_or_default();
34 let schema_name = parts.next().unwrap_or_default();
35 let function_name = parts.next().unwrap_or_default();
36 Self::new(catalog_name, schema_name, function_name, client)
37 }
38 pub fn catalog_name(&self) -> &str {
40 &self.catalog_name
41 }
42 pub fn schema_name(&self) -> &str {
44 &self.schema_name
45 }
46 pub fn name(&self) -> &str {
48 &self.function_name
49 }
50 pub fn full_name(&self) -> String {
52 format!(
53 "{}.{}.{}",
54 self.catalog_name, self.schema_name, self.function_name
55 )
56 }
57 pub fn get(&self) -> GetFunctionBuilder {
63 GetFunctionBuilder::new(
64 self.client.clone(),
65 format!(
66 "{}.{}.{}",
67 self.catalog_name, self.schema_name, self.function_name
68 ),
69 )
70 }
71 pub fn update(&self) -> UpdateFunctionBuilder {
76 UpdateFunctionBuilder::new(
77 self.client.clone(),
78 format!(
79 "{}.{}.{}",
80 self.catalog_name, self.schema_name, self.function_name
81 ),
82 )
83 }
84 pub fn delete(&self) -> DeleteFunctionBuilder {
89 DeleteFunctionBuilder::new(
90 self.client.clone(),
91 format!(
92 "{}.{}.{}",
93 self.catalog_name, self.schema_name, self.function_name
94 ),
95 )
96 }
97}