pub struct Syntax { /* private fields */ }Expand description
The SQL a statement is written in: a Dialect, and on MySQL’s
whether the server is MariaDB (and which version), where its SQL
differs from MySQL 8’s. A Dialect converts into its own syntax
(MySQL’s is MySQL 8’s); the ORM asks a navree_db::Db once which it
is.
On MariaDB a JSON value is JSON_EXTRACT(?, '$') (there is no CAST(.. AS JSON)), a shared lock is always LOCK IN SHARE MODE, a regular
expression is REGEXP with its case flag in the pattern, and a time
limit is SET STATEMENT max_statement_time = .. FOR. What MariaDB
lacks is refused: lateral joins, locks of named tables, indexes from
the end of a JSON array (MariaDB 10.9 to 11.4 answer them wrongly), and
before 10.9 json_overlaps, before 11.7 vector distances.
use navree_orm::{Dialect, Syntax};
let mariadb = Syntax::mariadb(11, 4);
assert_eq!(mariadb.dialect(), Dialect::MySql);
assert_eq!(mariadb.name(), "MariaDB");
assert_eq!(Syntax::from(Dialect::MySql).mariadb_version(), None);Implementations§
Source§impl Syntax
impl Syntax
Sourcepub fn of(dialect: Dialect, mariadb: Option<(u16, u16)>) -> Syntax
pub fn of(dialect: Dialect, mariadb: Option<(u16, u16)>) -> Syntax
The syntax of a server of dialect: MariaDB’s when mariadb holds
its version (on MySQL’s dialect only).
Sourcepub fn mariadb_version(self) -> Option<(u16, u16)>
pub fn mariadb_version(self) -> Option<(u16, u16)>
The MariaDB version, None on other servers.
Sourcepub fn is_mariadb(self) -> bool
pub fn is_mariadb(self) -> bool
Whether the server is MariaDB.
Trait Implementations§
impl Copy for Syntax
impl Eq for Syntax
impl StructuralPartialEq for Syntax
Auto Trait Implementations§
impl Forget for Syntax
impl Freeze for Syntax
impl Move for Syntax
impl RefUnwindSafe for Syntax
impl Send for Syntax
impl Sync for Syntax
impl Unpin for Syntax
impl UnsafeUnpin for Syntax
impl UnwindSafe for Syntax
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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