mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-19 08:39:44 +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:
@@ -5,9 +5,7 @@ use crate::{
|
||||
PgTypeInfo,
|
||||
};
|
||||
|
||||
pub(crate) use sqlx_core::database::{
|
||||
Database, HasArguments, HasStatement, HasStatementCache, HasValueRef,
|
||||
};
|
||||
pub(crate) use sqlx_core::database::{Database, HasStatementCache};
|
||||
|
||||
/// PostgreSQL database driver.
|
||||
#[derive(Debug)]
|
||||
@@ -27,30 +25,16 @@ impl Database for Postgres {
|
||||
type TypeInfo = PgTypeInfo;
|
||||
|
||||
type Value = PgValue;
|
||||
type ValueRef<'r> = PgValueRef<'r>;
|
||||
|
||||
type Arguments<'q> = PgArguments;
|
||||
type ArgumentBuffer<'q> = PgArgumentBuffer;
|
||||
|
||||
type Statement<'q> = PgStatement<'q>;
|
||||
|
||||
const NAME: &'static str = "PostgreSQL";
|
||||
|
||||
const URL_SCHEMES: &'static [&'static str] = &["postgres", "postgresql"];
|
||||
}
|
||||
|
||||
impl<'r> HasValueRef<'r> for Postgres {
|
||||
type Database = Postgres;
|
||||
|
||||
type ValueRef = PgValueRef<'r>;
|
||||
}
|
||||
|
||||
impl HasArguments<'_> for Postgres {
|
||||
type Database = Postgres;
|
||||
|
||||
type Arguments = PgArguments;
|
||||
|
||||
type ArgumentBuffer = PgArgumentBuffer;
|
||||
}
|
||||
|
||||
impl<'q> HasStatement<'q> for Postgres {
|
||||
type Database = Postgres;
|
||||
|
||||
type Statement = PgStatement<'q>;
|
||||
}
|
||||
|
||||
impl HasStatementCache for Postgres {}
|
||||
|
||||
Reference in New Issue
Block a user