pub struct CreateDatabaseBuilder {Show 22 fields
pub db_name: ObjectName,
pub if_not_exists: bool,
pub location: Option<String>,
pub managed_location: Option<String>,
pub or_replace: bool,
pub transient: bool,
pub clone: Option<ObjectName>,
pub data_retention_time_in_days: Option<u64>,
pub max_data_extension_time_in_days: Option<u64>,
pub external_volume: Option<String>,
pub catalog: Option<String>,
pub replace_invalid_characters: Option<bool>,
pub default_ddl_collation: Option<String>,
pub storage_serialization_policy: Option<StorageSerializationPolicy>,
pub comment: Option<String>,
pub default_charset: Option<String>,
pub default_collation: Option<String>,
pub catalog_sync: Option<String>,
pub catalog_sync_namespace_mode: Option<CatalogSyncNamespaceMode>,
pub catalog_sync_namespace_flatten_delimiter: Option<String>,
pub with_tags: Option<Vec<Tag>>,
pub with_contacts: Option<Vec<ContactEntry>>,
}Expand description
Builder for create database statement variant (1).
This structure helps building and accessing a create database with more ease, without needing to:
- Match the enum itself a lot of times; or
- Moving a lot of variables around the code.
§Example
use sqlparser::ast::helpers::stmt_create_database::CreateDatabaseBuilder;
use sqlparser::ast::{ColumnDef, Ident, ObjectName};
let builder = CreateDatabaseBuilder::new(ObjectName::from(vec![Ident::new("database_name")]))
.if_not_exists(true);
// You can access internal elements with ease
assert!(builder.if_not_exists);
// Convert to a statement
assert_eq!(
builder.build().to_string(),
"CREATE DATABASE IF NOT EXISTS database_name"
)Fields§
§db_name: ObjectNameThe database name to create.
if_not_exists: boolWhether IF NOT EXISTS was specified.
location: Option<String>Optional storage location for the database.
managed_location: Option<String>Optional managed storage location.
or_replace: boolWhether OR REPLACE was specified.
transient: boolWhether the database is TRANSIENT.
clone: Option<ObjectName>Optional CLONE source object name.
data_retention_time_in_days: Option<u64>Optional data retention time in days.
max_data_extension_time_in_days: Option<u64>Optional max data extension time in days.
external_volume: Option<String>Optional external volume identifier.
catalog: Option<String>Optional catalog name.
replace_invalid_characters: Option<bool>Whether to replace invalid characters.
default_ddl_collation: Option<String>Optional default DDL collation.
storage_serialization_policy: Option<StorageSerializationPolicy>Optional storage serialization policy.
comment: Option<String>Optional comment attached to the database.
default_charset: Option<String>Optional default character set (MySQL).
https://dev.mysql.com/doc/refman/8.4/en/create-database.html
default_collation: Option<String>Optional default collation (MySQL).
https://dev.mysql.com/doc/refman/8.4/en/create-database.html
catalog_sync: Option<String>Optional catalog sync configuration.
catalog_sync_namespace_mode: Option<CatalogSyncNamespaceMode>Optional catalog sync namespace mode.
catalog_sync_namespace_flatten_delimiter: Option<String>Optional namespace flatten delimiter for catalog sync.
Optional tags attached to the database.
with_contacts: Option<Vec<ContactEntry>>Optional contact entries associated with the database.
Implementations§
Source§impl CreateDatabaseBuilder
impl CreateDatabaseBuilder
Sourcepub fn new(name: ObjectName) -> CreateDatabaseBuilder
pub fn new(name: ObjectName) -> CreateDatabaseBuilder
Create a new CreateDatabaseBuilder with the given database name.
§Arguments
name- The name of the database to be created.
Sourcepub fn location(self, location: Option<String>) -> CreateDatabaseBuilder
pub fn location(self, location: Option<String>) -> CreateDatabaseBuilder
Set the location for the database.
Sourcepub fn managed_location(
self,
managed_location: Option<String>,
) -> CreateDatabaseBuilder
pub fn managed_location( self, managed_location: Option<String>, ) -> CreateDatabaseBuilder
Set the managed location for the database.
Sourcepub fn or_replace(self, or_replace: bool) -> CreateDatabaseBuilder
pub fn or_replace(self, or_replace: bool) -> CreateDatabaseBuilder
Set whether this is an OR REPLACE operation.
Sourcepub fn transient(self, transient: bool) -> CreateDatabaseBuilder
pub fn transient(self, transient: bool) -> CreateDatabaseBuilder
Set whether this is a transient database.
Sourcepub fn if_not_exists(self, if_not_exists: bool) -> CreateDatabaseBuilder
pub fn if_not_exists(self, if_not_exists: bool) -> CreateDatabaseBuilder
Set whether to use IF NOT EXISTS.
Sourcepub fn clone_clause(self, clone: Option<ObjectName>) -> CreateDatabaseBuilder
pub fn clone_clause(self, clone: Option<ObjectName>) -> CreateDatabaseBuilder
Set the clone clause for the database.
Sourcepub fn data_retention_time_in_days(
self,
data_retention_time_in_days: Option<u64>,
) -> CreateDatabaseBuilder
pub fn data_retention_time_in_days( self, data_retention_time_in_days: Option<u64>, ) -> CreateDatabaseBuilder
Set the data retention time in days.
Sourcepub fn max_data_extension_time_in_days(
self,
max_data_extension_time_in_days: Option<u64>,
) -> CreateDatabaseBuilder
pub fn max_data_extension_time_in_days( self, max_data_extension_time_in_days: Option<u64>, ) -> CreateDatabaseBuilder
Set the maximum data extension time in days.
Sourcepub fn external_volume(
self,
external_volume: Option<String>,
) -> CreateDatabaseBuilder
pub fn external_volume( self, external_volume: Option<String>, ) -> CreateDatabaseBuilder
Set the external volume for the database.
Sourcepub fn catalog(self, catalog: Option<String>) -> CreateDatabaseBuilder
pub fn catalog(self, catalog: Option<String>) -> CreateDatabaseBuilder
Set the catalog for the database.
Sourcepub fn replace_invalid_characters(
self,
replace_invalid_characters: Option<bool>,
) -> CreateDatabaseBuilder
pub fn replace_invalid_characters( self, replace_invalid_characters: Option<bool>, ) -> CreateDatabaseBuilder
Set whether to replace invalid characters.
Sourcepub fn default_ddl_collation(
self,
default_ddl_collation: Option<String>,
) -> CreateDatabaseBuilder
pub fn default_ddl_collation( self, default_ddl_collation: Option<String>, ) -> CreateDatabaseBuilder
Set the default DDL collation.
Sourcepub fn storage_serialization_policy(
self,
storage_serialization_policy: Option<StorageSerializationPolicy>,
) -> CreateDatabaseBuilder
pub fn storage_serialization_policy( self, storage_serialization_policy: Option<StorageSerializationPolicy>, ) -> CreateDatabaseBuilder
Set the storage serialization policy.
Sourcepub fn comment(self, comment: Option<String>) -> CreateDatabaseBuilder
pub fn comment(self, comment: Option<String>) -> CreateDatabaseBuilder
Set the comment for the database.
Sourcepub fn default_charset(
self,
default_charset: Option<String>,
) -> CreateDatabaseBuilder
pub fn default_charset( self, default_charset: Option<String>, ) -> CreateDatabaseBuilder
Set the default character set for the database.
Sourcepub fn default_collation(
self,
default_collation: Option<String>,
) -> CreateDatabaseBuilder
pub fn default_collation( self, default_collation: Option<String>, ) -> CreateDatabaseBuilder
Set the default collation for the database.
Sourcepub fn catalog_sync(self, catalog_sync: Option<String>) -> CreateDatabaseBuilder
pub fn catalog_sync(self, catalog_sync: Option<String>) -> CreateDatabaseBuilder
Set the catalog sync for the database.
Sourcepub fn catalog_sync_namespace_mode(
self,
catalog_sync_namespace_mode: Option<CatalogSyncNamespaceMode>,
) -> CreateDatabaseBuilder
pub fn catalog_sync_namespace_mode( self, catalog_sync_namespace_mode: Option<CatalogSyncNamespaceMode>, ) -> CreateDatabaseBuilder
Set the catalog sync namespace mode for the database.
Sourcepub fn catalog_sync_namespace_flatten_delimiter(
self,
catalog_sync_namespace_flatten_delimiter: Option<String>,
) -> CreateDatabaseBuilder
pub fn catalog_sync_namespace_flatten_delimiter( self, catalog_sync_namespace_flatten_delimiter: Option<String>, ) -> CreateDatabaseBuilder
Set the catalog sync namespace flatten delimiter for the database.
Set the tags for the database.
Sourcepub fn with_contacts(
self,
with_contacts: Option<Vec<ContactEntry>>,
) -> CreateDatabaseBuilder
pub fn with_contacts( self, with_contacts: Option<Vec<ContactEntry>>, ) -> CreateDatabaseBuilder
Set the contacts for the database.
Trait Implementations§
Source§impl Clone for CreateDatabaseBuilder
impl Clone for CreateDatabaseBuilder
Source§fn clone(&self) -> CreateDatabaseBuilder
fn clone(&self) -> CreateDatabaseBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CreateDatabaseBuilder
impl Debug for CreateDatabaseBuilder
Source§impl Hash for CreateDatabaseBuilder
impl Hash for CreateDatabaseBuilder
Source§impl PartialEq for CreateDatabaseBuilder
impl PartialEq for CreateDatabaseBuilder
Source§impl TryFrom<Statement> for CreateDatabaseBuilder
impl TryFrom<Statement> for CreateDatabaseBuilder
Source§type Error = ParserError
type Error = ParserError
Source§fn try_from(
stmt: Statement,
) -> Result<CreateDatabaseBuilder, <CreateDatabaseBuilder as TryFrom<Statement>>::Error>
fn try_from( stmt: Statement, ) -> Result<CreateDatabaseBuilder, <CreateDatabaseBuilder as TryFrom<Statement>>::Error>
Source§impl Visit for CreateDatabaseBuilder
impl Visit for CreateDatabaseBuilder
Source§impl VisitMut for CreateDatabaseBuilder
impl VisitMut for CreateDatabaseBuilder
Source§fn visit<V>(&mut self, visitor: &mut V) -> ControlFlow<<V as VisitorMut>::Break>where
V: VisitorMut,
fn visit<V>(&mut self, visitor: &mut V) -> ControlFlow<<V as VisitorMut>::Break>where
V: VisitorMut,
VisitorMut. Read moreimpl Eq for CreateDatabaseBuilder
impl StructuralPartialEq for CreateDatabaseBuilder
Auto Trait Implementations§
impl Freeze for CreateDatabaseBuilder
impl RefUnwindSafe for CreateDatabaseBuilder
impl Send for CreateDatabaseBuilder
impl Sync for CreateDatabaseBuilder
impl Unpin for CreateDatabaseBuilder
impl UnsafeUnpin for CreateDatabaseBuilder
impl UnwindSafe for CreateDatabaseBuilder
Blanket Implementations§
Source§impl<T> AlignerFor<1> for T
impl<T> AlignerFor<1> for T
Source§impl<T> AlignerFor<1024> for T
impl<T> AlignerFor<1024> for T
Source§type Aligner = AlignTo1024<T>
type Aligner = AlignTo1024<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<128> for T
impl<T> AlignerFor<128> for T
Source§type Aligner = AlignTo128<T>
type Aligner = AlignTo128<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<16> for T
impl<T> AlignerFor<16> for T
Source§impl<T> AlignerFor<16384> for T
impl<T> AlignerFor<16384> for T
Source§type Aligner = AlignTo16384<T>
type Aligner = AlignTo16384<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<2> for T
impl<T> AlignerFor<2> for T
Source§impl<T> AlignerFor<2048> for T
impl<T> AlignerFor<2048> for T
Source§type Aligner = AlignTo2048<T>
type Aligner = AlignTo2048<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<256> for T
impl<T> AlignerFor<256> for T
Source§type Aligner = AlignTo256<T>
type Aligner = AlignTo256<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<32> for T
impl<T> AlignerFor<32> for T
Source§impl<T> AlignerFor<32768> for T
impl<T> AlignerFor<32768> for T
Source§type Aligner = AlignTo32768<T>
type Aligner = AlignTo32768<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<4> for T
impl<T> AlignerFor<4> for T
Source§impl<T> AlignerFor<4096> for T
impl<T> AlignerFor<4096> for T
Source§type Aligner = AlignTo4096<T>
type Aligner = AlignTo4096<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<512> for T
impl<T> AlignerFor<512> for T
Source§type Aligner = AlignTo512<T>
type Aligner = AlignTo512<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<64> for T
impl<T> AlignerFor<64> for T
Source§impl<T> AlignerFor<8> for T
impl<T> AlignerFor<8> for T
Source§impl<T> AlignerFor<8192> for T
impl<T> AlignerFor<8192> for T
Source§type Aligner = AlignTo8192<T>
type Aligner = AlignTo8192<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<'a, T> RCowCompatibleRef<'a> for Twhere
T: Clone + 'a,
impl<'a, T> RCowCompatibleRef<'a> for Twhere
T: Clone + 'a,
Source§fn as_c_ref(from: &'a T) -> <T as RCowCompatibleRef<'a>>::RefC
fn as_c_ref(from: &'a T) -> <T as RCowCompatibleRef<'a>>::RefC
Source§fn as_rust_ref(from: <T as RCowCompatibleRef<'a>>::RefC) -> &'a T
fn as_rust_ref(from: <T as RCowCompatibleRef<'a>>::RefC) -> &'a T
Source§impl<S> ROExtAcc for S
impl<S> ROExtAcc for S
Source§fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
offset. Read moreSource§fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
offset. Read moreSource§fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
offset. Read moreSource§fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
offset. Read moreSource§impl<S> ROExtOps<Aligned> for S
impl<S> ROExtOps<Aligned> for S
Source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
offset) with value,
returning the previous value of the field. Read moreSource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
Source§impl<S> ROExtOps<Unaligned> for S
impl<S> ROExtOps<Unaligned> for S
Source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
offset) with value,
returning the previous value of the field. Read moreSource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
Source§impl<T> SelfOps for Twhere
T: ?Sized,
impl<T> SelfOps for Twhere
T: ?Sized,
Source§fn piped<F, U>(self, f: F) -> U
fn piped<F, U>(self, f: F) -> U
Source§fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
piped except that the function takes &Self
Useful for functions that take &Self instead of Self. Read moreSource§fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
piped, except that the function takes &mut Self.
Useful for functions that take &mut Self instead of Self.Source§fn mutated<F>(self, f: F) -> Self
fn mutated<F>(self, f: F) -> Self
Source§fn observe<F>(self, f: F) -> Self
fn observe<F>(self, f: F) -> Self
Source§fn as_ref_<T>(&self) -> &T
fn as_ref_<T>(&self) -> &T
AsRef,
using the turbofish .as_ref_::<_>() syntax. Read more