forked from transact-rs/sqlx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.rs
More file actions
49 lines (38 loc) 路 1.21 KB
/
Copy pathdatabase.rs
File metadata and controls
49 lines (38 loc) 路 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use std::fmt::Display;
use crate::arguments::Arguments;
use crate::connection::Connect;
use crate::cursor::Cursor;
use crate::row::Row;
use crate::types::TypeInfo;
/// A database driver.
///
/// This trait encapsulates a complete driver implementation to a specific
/// database (e.g., MySQL, Postgres).
pub trait Database
where
Self: Sized + Send + 'static,
Self: for<'c> HasRow<'c, Database = Self>,
Self: for<'c> HasRawValue<'c>,
Self: for<'c, 'q> HasCursor<'c, 'q, Database = Self>,
{
/// The concrete `Connection` implementation for this database.
type Connection: Connect<Database = Self>;
/// The concrete `Arguments` implementation for this database.
type Arguments: Arguments<Database = Self>;
/// The concrete `TypeInfo` implementation for this database.
type TypeInfo: TypeInfo;
/// The Rust type of table identifiers for this database.
type TableId: Display + Clone;
type RawBuffer;
}
pub trait HasRawValue<'c> {
type RawValue;
}
pub trait HasCursor<'c, 'q> {
type Database: Database;
type Cursor: Cursor<'c, 'q, Database = Self::Database>;
}
pub trait HasRow<'c> {
type Database: Database;
type Row: Row<'c, Database = Self::Database>;
}