pub struct SqlGenerator {
pub db_type: DatabaseType,
}Expand description
SQL 生成器
Fields§
§db_type: DatabaseType数据库类型
Implementations§
Source§impl SqlGenerator
impl SqlGenerator
Sourcepub fn new(db_type: DatabaseType) -> Self
pub fn new(db_type: DatabaseType) -> Self
创建新的 SQLGenerator
Sourcepub fn generate_column_def(&self, column_type: &ColumnType) -> String
pub fn generate_column_def(&self, column_type: &ColumnType) -> String
生成列定义的 SQL(仅类型部分,用于测试)
Sourcepub fn generate_drop_table_sql(
&self,
table_name: &str,
) -> Result<String, String>
pub fn generate_drop_table_sql( &self, table_name: &str, ) -> Result<String, String>
生成删除表的 SQL
Sourcepub fn generate_add_column_sql(
&self,
table_name: &str,
column: &Column,
) -> Result<String, String>
pub fn generate_add_column_sql( &self, table_name: &str, column: &Column, ) -> Result<String, String>
生成添加列的 SQL
Trait Implementations§
Source§impl Clone for SqlGenerator
impl Clone for SqlGenerator
Source§fn clone(&self) -> SqlGenerator
fn clone(&self) -> SqlGenerator
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SqlGenerator
impl RefUnwindSafe for SqlGenerator
impl Send for SqlGenerator
impl Sync for SqlGenerator
impl Unpin for SqlGenerator
impl UnsafeUnpin for SqlGenerator
impl UnwindSafe for SqlGenerator
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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