Skip to main content

aws_sdk_athena/types/
_column.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Contains metadata for a column in a table.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Column {
7    /// <p>The name of the column.</p>
8    pub name: ::std::string::String,
9    /// <p>The data type of the column.</p>
10    pub r#type: ::std::option::Option<::std::string::String>,
11    /// <p>Optional information about the column.</p>
12    pub comment: ::std::option::Option<::std::string::String>,
13}
14impl Column {
15    /// <p>The name of the column.</p>
16    pub fn name(&self) -> &str {
17        use std::ops::Deref;
18        self.name.deref()
19    }
20    /// <p>The data type of the column.</p>
21    pub fn r#type(&self) -> ::std::option::Option<&str> {
22        self.r#type.as_deref()
23    }
24    /// <p>Optional information about the column.</p>
25    pub fn comment(&self) -> ::std::option::Option<&str> {
26        self.comment.as_deref()
27    }
28}
29impl Column {
30    /// Creates a new builder-style object to manufacture [`Column`](crate::types::Column).
31    pub fn builder() -> crate::types::builders::ColumnBuilder {
32        crate::types::builders::ColumnBuilder::default()
33    }
34}
35
36/// A builder for [`Column`](crate::types::Column).
37#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
38#[non_exhaustive]
39pub struct ColumnBuilder {
40    pub(crate) name: ::std::option::Option<::std::string::String>,
41    pub(crate) r#type: ::std::option::Option<::std::string::String>,
42    pub(crate) comment: ::std::option::Option<::std::string::String>,
43}
44impl ColumnBuilder {
45    /// <p>The name of the column.</p>
46    /// This field is required.
47    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
48        self.name = ::std::option::Option::Some(input.into());
49        self
50    }
51    /// <p>The name of the column.</p>
52    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
53        self.name = input;
54        self
55    }
56    /// <p>The name of the column.</p>
57    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
58        &self.name
59    }
60    /// <p>The data type of the column.</p>
61    pub fn r#type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
62        self.r#type = ::std::option::Option::Some(input.into());
63        self
64    }
65    /// <p>The data type of the column.</p>
66    pub fn set_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
67        self.r#type = input;
68        self
69    }
70    /// <p>The data type of the column.</p>
71    pub fn get_type(&self) -> &::std::option::Option<::std::string::String> {
72        &self.r#type
73    }
74    /// <p>Optional information about the column.</p>
75    pub fn comment(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
76        self.comment = ::std::option::Option::Some(input.into());
77        self
78    }
79    /// <p>Optional information about the column.</p>
80    pub fn set_comment(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
81        self.comment = input;
82        self
83    }
84    /// <p>Optional information about the column.</p>
85    pub fn get_comment(&self) -> &::std::option::Option<::std::string::String> {
86        &self.comment
87    }
88    /// Consumes the builder and constructs a [`Column`](crate::types::Column).
89    /// This method will fail if any of the following fields are not set:
90    /// - [`name`](crate::types::builders::ColumnBuilder::name)
91    pub fn build(self) -> ::std::result::Result<crate::types::Column, ::aws_smithy_types::error::operation::BuildError> {
92        ::std::result::Result::Ok(crate::types::Column {
93            name: self.name.ok_or_else(|| {
94                ::aws_smithy_types::error::operation::BuildError::missing_field(
95                    "name",
96                    "name was not specified but it is required when building Column",
97                )
98            })?,
99            r#type: self.r#type,
100            comment: self.comment,
101        })
102    }
103}