pub struct SchemaUpdate { /* private fields */ }Expand description
A pending schema update that can be applied to a schema to produce a new version.
Implementations§
Source§impl SchemaUpdate
impl SchemaUpdate
pub fn new() -> Self
Sourcepub fn add_column(
self,
parent_id: Option<i32>,
name: impl Into<String>,
field_type: Type,
doc: Option<String>,
) -> Self
pub fn add_column( self, parent_id: Option<i32>, name: impl Into<String>, field_type: Type, doc: Option<String>, ) -> Self
adds a new column to the schema.
Sourcepub fn delete_column(self, field_id: i32) -> Self
pub fn delete_column(self, field_id: i32) -> Self
Deletes a column from the schema.
Sourcepub fn rename_column(self, field_id: i32, new_name: impl Into<String>) -> Self
pub fn rename_column(self, field_id: i32, new_name: impl Into<String>) -> Self
Renames a column.
Sourcepub fn update_type(self, field_id: i32, new_type: Type) -> Self
pub fn update_type(self, field_id: i32, new_type: Type) -> Self
Updates a column’s type (must be compatible).
Sourcepub fn make_optional(self, field_id: i32) -> Self
pub fn make_optional(self, field_id: i32) -> Self
Makes a required column optional.
Sourcepub fn apply(
self,
base_schema: &Schema,
new_schema_id: i32,
next_column_id: &mut i32,
) -> Result<Schema, String>
pub fn apply( self, base_schema: &Schema, new_schema_id: i32, next_column_id: &mut i32, ) -> Result<Schema, String>
Applies the changes to a base schema, producing a new schema.
§Arguments
base_schema- The schema to start fromnew_schema_id- The ID for the new schemanext_column_id- A mutable reference to the next available column ID setter
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SchemaUpdate
impl RefUnwindSafe for SchemaUpdate
impl Send for SchemaUpdate
impl Sync for SchemaUpdate
impl Unpin for SchemaUpdate
impl UnwindSafe for SchemaUpdate
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
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> ⓘ
Converts
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> ⓘ
Converts
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 more