pub struct Partition {
pub table: String,
pub schema: Option<String>,
pub partition_type: PartitionType,
pub columns: Vec<String>,
pub partitions: PartitionDef,
pub comment: Option<String>,
}Expand description
A table partition specification.
Fields§
§table: StringTable name.
schema: Option<String>Schema name (optional).
partition_type: PartitionTypePartition type.
columns: Vec<String>Partition columns.
partitions: PartitionDefPartition definitions.
comment: Option<String>Optional comment.
Implementations§
Source§impl Partition
impl Partition
Sourcepub fn builder(table: impl Into<String>) -> PartitionBuilder
pub fn builder(table: impl Into<String>) -> PartitionBuilder
Create a new partition builder.
Sourcepub fn qualified_table(&self) -> Cow<'_, str>
pub fn qualified_table(&self) -> Cow<'_, str>
Get the fully qualified table name.
Sourcepub fn to_postgres_partition_clause(&self) -> String
pub fn to_postgres_partition_clause(&self) -> String
Generate PostgreSQL CREATE TABLE with partitioning.
Sourcepub fn to_postgres_create_partition(&self, def: &RangePartitionDef) -> String
pub fn to_postgres_create_partition(&self, def: &RangePartitionDef) -> String
Generate PostgreSQL CREATE TABLE for a child partition.
Sourcepub fn to_postgres_create_list_partition(
&self,
def: &ListPartitionDef,
) -> String
pub fn to_postgres_create_list_partition( &self, def: &ListPartitionDef, ) -> String
Generate PostgreSQL CREATE TABLE for a list partition.
Sourcepub fn to_postgres_create_hash_partition(
&self,
def: &HashPartitionDef,
) -> String
pub fn to_postgres_create_hash_partition( &self, def: &HashPartitionDef, ) -> String
Generate PostgreSQL CREATE TABLE for a hash partition.
Sourcepub fn to_postgres_create_all_partitions(&self) -> Vec<String>
pub fn to_postgres_create_all_partitions(&self) -> Vec<String>
Generate all PostgreSQL partition creation SQL.
Sourcepub fn to_mysql_partition_clause(&self) -> String
pub fn to_mysql_partition_clause(&self) -> String
Generate MySQL PARTITION BY clause.
Sourcepub fn to_mssql_partition_sql(&self) -> QueryResult<Vec<String>>
pub fn to_mssql_partition_sql(&self) -> QueryResult<Vec<String>>
Generate MSSQL partition function and scheme.
Sourcepub fn attach_partition_sql(
&self,
partition_name: &str,
db_type: DatabaseType,
) -> QueryResult<String>
pub fn attach_partition_sql( &self, partition_name: &str, db_type: DatabaseType, ) -> QueryResult<String>
Generate SQL for attaching a partition.
Sourcepub fn detach_partition_sql(
&self,
partition_name: &str,
db_type: DatabaseType,
) -> QueryResult<String>
pub fn detach_partition_sql( &self, partition_name: &str, db_type: DatabaseType, ) -> QueryResult<String>
Generate SQL for detaching a partition.
Sourcepub fn drop_partition_sql(
&self,
partition_name: &str,
db_type: DatabaseType,
) -> QueryResult<String>
pub fn drop_partition_sql( &self, partition_name: &str, db_type: DatabaseType, ) -> QueryResult<String>
Generate SQL for dropping a partition.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Partition
impl<'de> Deserialize<'de> for Partition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Partition
impl StructuralPartialEq for Partition
Auto Trait Implementations§
impl Freeze for Partition
impl RefUnwindSafe for Partition
impl Send for Partition
impl Sync for Partition
impl Unpin for Partition
impl UnwindSafe for Partition
Blanket Implementations§
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
Mutably borrows from an owned value. Read more