mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-04-11 22:35:05 +00:00
Generic Associated Types in Database, replacing HasValueRef, HasArguments, HasStatement (#2973)
* HasValueRef, HasArguments, HasStatement -> Database GATs replace the associated types from the generic traits `HasValueRef<'r>`, `HasArguments<'q>` and `HasStatement<'q>` with generic associated types in `Database` * fixup after rebase --------- Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
This commit is contained in:
@@ -3,9 +3,7 @@ use crate::{
|
||||
MySqlArguments, MySqlColumn, MySqlConnection, MySqlQueryResult, MySqlRow, MySqlStatement,
|
||||
MySqlTransactionManager, MySqlTypeInfo,
|
||||
};
|
||||
pub(crate) use sqlx_core::database::{
|
||||
Database, HasArguments, HasStatement, HasStatementCache, HasValueRef,
|
||||
};
|
||||
pub(crate) use sqlx_core::database::{Database, HasStatementCache};
|
||||
|
||||
/// MySQL database driver.
|
||||
#[derive(Debug)]
|
||||
@@ -25,30 +23,16 @@ impl Database for MySql {
|
||||
type TypeInfo = MySqlTypeInfo;
|
||||
|
||||
type Value = MySqlValue;
|
||||
type ValueRef<'r> = MySqlValueRef<'r>;
|
||||
|
||||
type Arguments<'q> = MySqlArguments;
|
||||
type ArgumentBuffer<'q> = Vec<u8>;
|
||||
|
||||
type Statement<'q> = MySqlStatement<'q>;
|
||||
|
||||
const NAME: &'static str = "MySQL";
|
||||
|
||||
const URL_SCHEMES: &'static [&'static str] = &["mysql", "mariadb"];
|
||||
}
|
||||
|
||||
impl<'r> HasValueRef<'r> for MySql {
|
||||
type Database = MySql;
|
||||
|
||||
type ValueRef = MySqlValueRef<'r>;
|
||||
}
|
||||
|
||||
impl HasArguments<'_> for MySql {
|
||||
type Database = MySql;
|
||||
|
||||
type Arguments = MySqlArguments;
|
||||
|
||||
type ArgumentBuffer = Vec<u8>;
|
||||
}
|
||||
|
||||
impl<'q> HasStatement<'q> for MySql {
|
||||
type Database = MySql;
|
||||
|
||||
type Statement = MySqlStatement<'q>;
|
||||
}
|
||||
|
||||
impl HasStatementCache for MySql {}
|
||||
|
||||
Reference in New Issue
Block a user