pub struct Sequence {
pub name: String,
pub schema: Option<String>,
pub start: i64,
pub increment: i64,
pub min_value: Option<i64>,
pub max_value: Option<i64>,
pub cycle: bool,
pub cache: Option<i64>,
pub owned_by: Option<OwnedBy>,
pub comment: Option<String>,
}Expand description
A database sequence definition.
Fields§
§name: StringSequence name.
schema: Option<String>Schema name (optional).
start: i64Starting value.
increment: i64Increment value.
min_value: Option<i64>Minimum value (None for no minimum).
max_value: Option<i64>Maximum value (None for no maximum).
cycle: boolWhether the sequence cycles when reaching max/min.
cache: Option<i64>Number of values to cache (for performance).
owned_by: Option<OwnedBy>Whether the sequence is owned by a column.
comment: Option<String>Optional comment/description.
Implementations§
Source§impl Sequence
impl Sequence
Sourcepub fn builder(name: impl Into<String>) -> SequenceBuilder
pub fn builder(name: impl Into<String>) -> SequenceBuilder
Create a new sequence builder.
Sourcepub fn qualified_name(&self) -> Cow<'_, str>
pub fn qualified_name(&self) -> Cow<'_, str>
Get the fully qualified sequence name.
Sourcepub fn to_postgres_create_sql(&self) -> String
pub fn to_postgres_create_sql(&self) -> String
Generate PostgreSQL CREATE SEQUENCE SQL.
Sourcepub fn to_mssql_create_sql(&self) -> String
pub fn to_mssql_create_sql(&self) -> String
Generate MSSQL CREATE SEQUENCE SQL.
Sourcepub fn to_create_sql(&self, db_type: DatabaseType) -> QueryResult<String>
pub fn to_create_sql(&self, db_type: DatabaseType) -> QueryResult<String>
Generate CREATE SEQUENCE SQL for the specified database type.
Sourcepub fn to_drop_sql(&self, db_type: DatabaseType) -> QueryResult<String>
pub fn to_drop_sql(&self, db_type: DatabaseType) -> QueryResult<String>
Generate DROP SEQUENCE SQL.
Sourcepub fn to_alter_sql(&self, db_type: DatabaseType) -> QueryResult<String>
pub fn to_alter_sql(&self, db_type: DatabaseType) -> QueryResult<String>
Generate ALTER SEQUENCE SQL.
Sourcepub fn restart_sql(
&self,
value: i64,
db_type: DatabaseType,
) -> QueryResult<String>
pub fn restart_sql( &self, value: i64, db_type: DatabaseType, ) -> QueryResult<String>
Generate SQL to restart the sequence at a specific value.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Sequence
impl<'de> Deserialize<'de> for Sequence
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 Sequence
impl StructuralPartialEq for Sequence
Auto Trait Implementations§
impl Freeze for Sequence
impl RefUnwindSafe for Sequence
impl Send for Sequence
impl Sync for Sequence
impl Unpin for Sequence
impl UnwindSafe for Sequence
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