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:
nitn3lav
2024-03-14 20:35:52 +01:00
committed by GitHub
parent 936744dfd6
commit 9ba488c831
33 changed files with 173 additions and 284 deletions

View File

@@ -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 {}