pub struct GenericSQLVirtualServerModel(/* private fields */);Expand description
A stateless SQL query builder virtual server operations.
This struct generates SQL query strings without executing them, allowing the caller to execute the queries against a SQL connection.
Implementations§
Source§impl GenericSQLVirtualServerModel
impl GenericSQLVirtualServerModel
Sourcepub fn new(args: GenericSQLVirtualServerModelArgs) -> Self
pub fn new(args: GenericSQLVirtualServerModelArgs) -> Self
Creates a new GenericSQLVirtualServerModel instance.
Sourcepub fn get_hosted_tables(&self) -> GenericSQLResult<String>
pub fn get_hosted_tables(&self) -> GenericSQLResult<String>
Sourcepub fn table_schema(&self, table_id: &str) -> GenericSQLResult<String>
pub fn table_schema(&self, table_id: &str) -> GenericSQLResult<String>
Sourcepub fn table_size(&self, table_id: &str) -> GenericSQLResult<String>
pub fn table_size(&self, table_id: &str) -> GenericSQLResult<String>
Sourcepub fn view_column_size(&self, view_id: &str) -> GenericSQLResult<String>
pub fn view_column_size(&self, view_id: &str) -> GenericSQLResult<String>
Sourcepub fn expressions_describe(
&self,
table_id: &str,
config: &ViewConfig,
) -> GenericSQLResult<Option<String>>
pub fn expressions_describe( &self, table_id: &str, config: &ViewConfig, ) -> GenericSQLResult<Option<String>>
Returns the SQL query that plans every expression of config at once
against table_id.
§Returns
SQL: DESCRIBE (SELECT {expr} AS "{alias}", ... FROM {table_id})
Sourcepub fn expression_describe(
&self,
table_id: &str,
expression: &str,
) -> GenericSQLResult<String>
pub fn expression_describe( &self, table_id: &str, expression: &str, ) -> GenericSQLResult<String>
Returns the SQL query that plans one expression against a table.
§Returns
SQL: DESCRIBE (SELECT {expression} FROM {table_id})
Sourcepub fn table_describe(
&self,
table_id: &str,
config: &ViewConfig,
schema: &IndexMap<String, ColumnType>,
) -> GenericSQLResult<Option<String>>
pub fn table_describe( &self, table_id: &str, config: &ViewConfig, schema: &IndexMap<String, ColumnType>, ) -> GenericSQLResult<Option<String>>
Returns the SQL query that plans the view config would build against
table_id, without materializing it.
§Returns
SQL: DESCRIBE (SELECT ... GROUP BY ...)
Sourcepub fn view_delete(&self, view_id: &str) -> GenericSQLResult<String>
pub fn view_delete(&self, view_id: &str) -> GenericSQLResult<String>
Sourcepub fn table_make_view(
&self,
table_id: &str,
view_id: &str,
config: &ViewConfig,
schema: &IndexMap<String, ColumnType>,
) -> GenericSQLResult<String>
pub fn table_make_view( &self, table_id: &str, view_id: &str, config: &ViewConfig, schema: &IndexMap<String, ColumnType>, ) -> GenericSQLResult<String>
Returns the SQL query to create a view from a table with the given configuration.
§Arguments
table_id- The identifier of the source table.view_id- The identifier for the new view.config- The view configuration specifying columns, group_by, split_by, etc.schema- The schema of the source table (column names to types).
§Returns
SQL: CREATE TABLE {view_id} AS (...)
Sourcepub fn view_make_table(
&self,
view_id: &str,
table_id: &str,
config: &ViewConfig,
view_schema: &IndexMap<String, ColumnType>,
schema: Option<&IndexMap<String, ColumnType>>,
) -> GenericSQLResult<String>
pub fn view_make_table( &self, view_id: &str, table_id: &str, config: &ViewConfig, view_schema: &IndexMap<String, ColumnType>, schema: Option<&IndexMap<String, ColumnType>>, ) -> GenericSQLResult<String>
Returns the SQL query to create a table from a view, with the view’s
row path unrolled into key columns named after their group_by
columns and aggregates of those columns qualified by their aggregate.
§Arguments
view_id- The identifier of the source view.table_id- The identifier for the new table.config- The configuration the view was created with.view_schema- The schema of the view’s relation.schema- The columns of the new table, in place of the view’s.
§Returns
SQL: CREATE TABLE {table_id} AS (SELECT ... FROM {view_id})
Sourcepub fn view_get_data(
&self,
view_id: &str,
config: &ViewConfig,
viewport: &ViewPort,
schema: &IndexMap<String, ColumnType>,
) -> GenericSQLResult<String>
pub fn view_get_data( &self, view_id: &str, config: &ViewConfig, viewport: &ViewPort, schema: &IndexMap<String, ColumnType>, ) -> GenericSQLResult<String>
Returns the SQL query to fetch data from a view with the given viewport.
§Arguments
view_id- The identifier of the view.config- The view configuration.viewport- The viewport specifying row/column ranges.schema- The schema of the view (column names to types).
§Returns
SQL: SELECT ... FROM {view_id} LIMIT ... OFFSET ...
Sourcepub fn view_schema(&self, view_id: &str) -> GenericSQLResult<String>
pub fn view_schema(&self, view_id: &str) -> GenericSQLResult<String>
Sourcepub fn view_size(&self, view_id: &str) -> GenericSQLResult<String>
pub fn view_size(&self, view_id: &str) -> GenericSQLResult<String>
Sourcepub fn view_get_min_max(
&self,
view_id: &str,
column_name: &str,
config: &ViewConfig,
) -> GenericSQLResult<String>
pub fn view_get_min_max( &self, view_id: &str, column_name: &str, config: &ViewConfig, ) -> GenericSQLResult<String>
Returns the SQL query to get the min and max values of a column.
§Arguments
view_id- The identifier of the view.column_name- The name of the column.config- The view configuration.
§Returns
SQL: SELECT MIN("column_name"), MAX("column_name") FROM {view_id}
When the view uses ROLLUP grouping (non-flat mode with group_by),
a WHERE __GROUPING_ID__ = 0 clause is added to exclude non-leaf rows.
Trait Implementations§
Source§impl Clone for GenericSQLVirtualServerModel
impl Clone for GenericSQLVirtualServerModel
Source§impl Debug for GenericSQLVirtualServerModel
impl Debug for GenericSQLVirtualServerModel
Auto Trait Implementations§
impl Freeze for GenericSQLVirtualServerModel
impl RefUnwindSafe for GenericSQLVirtualServerModel
impl Send for GenericSQLVirtualServerModel
impl Sync for GenericSQLVirtualServerModel
impl Unpin for GenericSQLVirtualServerModel
impl UnsafeUnpin for GenericSQLVirtualServerModel
impl UnwindSafe for GenericSQLVirtualServerModel
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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