sqlx_build_trust_postgres/
database.rs

1use crate::arguments::PgArgumentBuffer;
2use crate::value::{PgValue, PgValueRef};
3use crate::{
4    PgArguments, PgColumn, PgConnection, PgQueryResult, PgRow, PgStatement, PgTransactionManager,
5    PgTypeInfo,
6};
7
8pub(crate) use sqlx_core::database::{
9    Database, HasArguments, HasStatement, HasStatementCache, HasValueRef,
10};
11
12/// PostgreSQL database driver.
13#[derive(Debug)]
14pub struct Postgres;
15
16impl Database for Postgres {
17    type Connection = PgConnection;
18
19    type TransactionManager = PgTransactionManager;
20
21    type Row = PgRow;
22
23    type QueryResult = PgQueryResult;
24
25    type Column = PgColumn;
26
27    type TypeInfo = PgTypeInfo;
28
29    type Value = PgValue;
30
31    const NAME: &'static str = "PostgreSQL";
32
33    const URL_SCHEMES: &'static [&'static str] = &["postgres", "postgresql"];
34}
35
36impl<'r> HasValueRef<'r> for Postgres {
37    type Database = Postgres;
38
39    type ValueRef = PgValueRef<'r>;
40}
41
42impl HasArguments<'_> for Postgres {
43    type Database = Postgres;
44
45    type Arguments = PgArguments;
46
47    type ArgumentBuffer = PgArgumentBuffer;
48}
49
50impl<'q> HasStatement<'q> for Postgres {
51    type Database = Postgres;
52
53    type Statement = PgStatement<'q>;
54}
55
56impl HasStatementCache for Postgres {}