pub struct SchemaRegistry { /* private fields */ }Expand description
Schema registry for managing table definitions
Implementations§
Source§impl SchemaRegistry
impl SchemaRegistry
Sourcepub fn new() -> SchemaRegistry
pub fn new() -> SchemaRegistry
Create a new empty schema registry
Sourcepub fn create_table(&mut self, table: TableDef) -> Result<(), SchemaError>
pub fn create_table(&mut self, table: TableDef) -> Result<(), SchemaError>
Create a new table
Sourcepub fn drop_table(&mut self, name: &str) -> Result<TableDef, SchemaError>
pub fn drop_table(&mut self, name: &str) -> Result<TableDef, SchemaError>
Drop a table
Sourcepub fn get_table_mut(&mut self, name: &str) -> Option<&mut TableDef>
pub fn get_table_mut(&mut self, name: &str) -> Option<&mut TableDef>
Get a mutable table definition by name
Sourcepub fn list_tables(&self) -> Vec<&str>
pub fn list_tables(&self) -> Vec<&str>
List all table names
Sourcepub fn table_count(&self) -> usize
pub fn table_count(&self) -> usize
Get number of tables
Sourcepub fn table_exists(&self, name: &str) -> bool
pub fn table_exists(&self, name: &str) -> bool
Check if a table exists
Sourcepub fn add_column(
&mut self,
table_name: &str,
column: ColumnDef,
) -> Result<(), SchemaError>
pub fn add_column( &mut self, table_name: &str, column: ColumnDef, ) -> Result<(), SchemaError>
Add a column to an existing table
Sourcepub fn drop_column(
&mut self,
table_name: &str,
column_name: &str,
) -> Result<(), SchemaError>
pub fn drop_column( &mut self, table_name: &str, column_name: &str, ) -> Result<(), SchemaError>
Drop a column from an existing table
Sourcepub fn create_index(
&mut self,
table_name: &str,
index: IndexDef,
) -> Result<(), SchemaError>
pub fn create_index( &mut self, table_name: &str, index: IndexDef, ) -> Result<(), SchemaError>
Create an index on a table
Sourcepub fn drop_index(
&mut self,
table_name: &str,
index_name: &str,
) -> Result<(), SchemaError>
pub fn drop_index( &mut self, table_name: &str, index_name: &str, ) -> Result<(), SchemaError>
Drop an index from a table
Sourcepub fn rename_table(
&mut self,
old_name: &str,
new_name: &str,
) -> Result<(), SchemaError>
pub fn rename_table( &mut self, old_name: &str, new_name: &str, ) -> Result<(), SchemaError>
Rename a table
Sourcepub fn migrations(&self) -> &[Migration]
pub fn migrations(&self) -> &[Migration]
Get migration history
Sourcepub fn from_bytes(data: &[u8]) -> Result<SchemaRegistry, SchemaError>
pub fn from_bytes(data: &[u8]) -> Result<SchemaRegistry, SchemaError>
Deserialize from bytes
Trait Implementations§
Source§impl Default for SchemaRegistry
impl Default for SchemaRegistry
Source§fn default() -> SchemaRegistry
fn default() -> SchemaRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SchemaRegistry
impl RefUnwindSafe for SchemaRegistry
impl Send for SchemaRegistry
impl Sync for SchemaRegistry
impl Unpin for SchemaRegistry
impl UnsafeUnpin for SchemaRegistry
impl UnwindSafe for SchemaRegistry
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request