pub struct MySql { /* private fields */ }Expand description
The MySQL schema: backtick quoting, AUTO_INCREMENT, inline indexes,
PARTITION BY ... PARTITIONS n.
use utopia_query::schema::{MySql, Schema};
let schema = MySql::new();
let mut table = schema.table("events");
table.id("id");
table.json("payload").nullable();
table.partition_by_hash("id", Some(4))?;
assert_eq!(
table.create()?.query,
"CREATE TABLE `events` (`id` BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, `payload` JSON NULL, \
PRIMARY KEY (`id`)) PARTITION BY HASH(id) PARTITIONS 4"
);use Utopia\Query\Schema\MySQL;
$table = (new MySQL())->table('events');
$table->id();
$table->json('payload')->nullable();
$table->partitionByHash('id', 4);
echo $table->create()->query, "\n";PHP: Utopia\Query\Schema\MySQL.
Implementations§
Trait Implementations§
Source§impl AnalyzeTable for MySql
impl AnalyzeTable for MySql
impl AutoIncrement for MySql
impl Checks for MySql
impl Collation for MySql
impl ColumnAlterations for MySql
impl Comment for MySql
impl CompositePrimary for MySql
Source§impl CreatePartition for MySql
impl CreatePartition for MySql
Source§impl DropPartition for MySql
impl DropPartition for MySql
impl ForeignKeys for MySql
Source§impl ForeignKeys for MySql
impl ForeignKeys for MySql
impl FulltextSpatialIndex for MySql
impl Generated for MySql
impl InlineForeignKey for MySql
Source§impl Partitioning for MySql
impl Partitioning for MySql
impl Positioning for MySql
Source§impl Procedures for MySql
impl Procedures for MySql
Source§impl RenameIndex for MySql
impl RenameIndex for MySql
Source§impl ReplaceView for MySql
impl ReplaceView for MySql
Source§fn create_or_replace_view(
&self,
name: &str,
query: &mut dyn AnyBuilder,
) -> Result<Statement>
fn create_or_replace_view( &self, name: &str, query: &mut dyn AnyBuilder, ) -> Result<Statement>
Source§impl Schema for MySql
impl Schema for MySql
Source§fn set_executor(&mut self, executor: Executor) -> &mut Self
fn set_executor(&mut self, executor: Executor) -> &mut Self
Sets the executor every statement compiled from now on carries
(
Statement::execute runs it). Read moreSource§fn quote(&self, identifier: &str) -> Result<String>
fn quote(&self, identifier: &str) -> Result<String>
Quotes a possibly qualified identifier. Read more
Source§fn quote_literal(&self, identifier: &str) -> Result<String>
fn quote_literal(&self, identifier: &str) -> Result<String>
Quotes one identifier, dots included. Read more
Source§fn compile_column_type(&self, column: &Column<Self>) -> Result<String>
fn compile_column_type(&self, column: &Column<Self>) -> Result<String>
The SQL type of
column. Read moreSource§fn compile_auto_increment(&self) -> &'static str
fn compile_auto_increment(&self) -> &'static str
The auto-increment keyword. Read more
Source§fn compile_create_suffix(&self, table: &Table<Self>) -> String
fn compile_create_suffix(&self, table: &Table<Self>) -> String
Clauses after the column list of
CREATE TABLE (partitioning). Read moreSource§fn table(&self, name: impl Into<String>) -> Table<Self>
fn table(&self, name: impl Into<String>) -> Table<Self>
A blueprint of table
name compiled by this schema. Read moreSource§fn compile_drop(&self, name: &str, if_exists: bool) -> Result<Statement>
fn compile_drop(&self, name: &str, if_exists: bool) -> Result<Statement>
DROP TABLE [IF EXISTS] name. Read moreSource§fn create_index(
&self,
table: &str,
name: &str,
columns: &[&str],
options: &IndexOptions,
) -> Result<Statement>
fn create_index( &self, table: &str, name: &str, columns: &[&str], options: &IndexOptions, ) -> Result<Statement>
Source§fn compile_generated_clause(&self, column: &Column<Self>) -> String
fn compile_generated_clause(&self, column: &Column<Self>) -> String
GENERATED ALWAYS AS (...) STORED|VIRTUAL. Read moreSource§fn quote_collation(&self, collation: &str) -> Result<String>
fn quote_collation(&self, collation: &str) -> Result<String>
A collation name as
COLLATE takes it. Read moreSource§fn literal(&self) -> StringLiteral
fn literal(&self) -> StringLiteral
How the dialect writes a string literal: comments, defaults and enum
values are inlined, since DDL takes no bound parameters. Read more
Source§fn compile_unsigned(&self) -> &'static str
fn compile_unsigned(&self) -> &'static str
The unsigned keyword, or empty where there is none. Read more
impl Serial for MySql
impl Srid for MySql
impl StandardPartitioning for MySql
Source§impl TableComments for MySql
impl TableComments for MySql
Source§impl Triggers for MySql
impl Triggers for MySql
Source§fn create_trigger(
&self,
name: &str,
table: &str,
timing: TriggerTiming,
event: TriggerEvent,
body: &str,
) -> Result<Statement>
fn create_trigger( &self, name: &str, table: &str, timing: TriggerTiming, event: TriggerEvent, body: &str, ) -> Result<Statement>
Creates trigger
name on table, running body (verbatim, trusted)
for each row at timing of event. Read moreimpl Unique for MySql
impl VirtualGenerated for MySql
Auto Trait Implementations§
impl !RefUnwindSafe for MySql
impl !UnwindSafe for MySql
impl Forget for MySql
impl Freeze for MySql
impl Move for MySql
impl Send for MySql
impl Sync for MySql
impl Unpin for MySql
impl UnsafeUnpin for MySql
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