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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
use futures::future::BoxFuture;
use std::time::Duration;
use url::Url;
use rsdbc_core::connection::{Batch, Connection, ConnectionFactory, ConnectionFactoryMetadata, ConnectionFactoryOptions, ConnectionFactoryProvider, ConnectionMetadata, IsolationLevel, SslMode, Statement, ValidationDepth};
use rsdbc_core::Result;
pub struct MySqlConnectionConfiguration {
pub domain: String,
pub port: i32,
pub ssl: MySqlSslConfiguration,
pub tcp_keep_alive: bool,
pub tcp_no_delay: bool,
pub connection_timeout: Duration,
pub socket_timeout: Duration,
pub username: String,
pub password: String,
pub query_cache_size: i32,
pub prepare_cache_size: i32,
}
pub struct MySqlSslConfiguration {
pub ssl_mode: SslMode,
pub tls_version: Vec<String>,
pub ssl_cert: Url,
pub ssl_key: Url,
pub ssl_password: String,
pub ssl_root_cert: Url,
}
pub struct MySqlConnection;
impl Connection for MySqlConnection {
fn begin_transaction(&mut self) -> Result<()> {
todo!()
}
fn close(&mut self) -> Result<()> {
todo!()
}
fn commit_transaction(&mut self) {
todo!()
}
fn create_batch(&mut self) -> Result<Box<dyn Batch>> {
todo!()
}
fn create_savepoint(&mut self, name: &str) {
todo!()
}
fn create_statement(&mut self, sql: &str) -> Result<Box<dyn Statement<'_> + '_>> {
todo!()
}
fn is_auto_commit(&mut self) -> bool {
todo!()
}
fn metadata(&mut self) -> Result<Box<dyn ConnectionMetadata>> {
todo!()
}
fn transaction_isolation_level(&mut self) -> IsolationLevel {
todo!()
}
fn release_savepoint(&mut self, name: &str) {
todo!()
}
fn rollback_transaction(&mut self) {
todo!()
}
fn rollback_transaction_to_savepoint(&mut self, name: String) {
todo!()
}
fn auto_commit(&mut self, commit: bool) {
todo!()
}
fn set_transaction_isolation_level(&mut self, isolation_level: IsolationLevel) {
todo!()
}
fn validate(&mut self, depth: ValidationDepth) -> bool {
todo!()
}
}
pub struct MySqlConnectionFactory;
impl ConnectionFactory for MySqlConnectionFactory {
fn connect(&self) -> BoxFuture<'_, Result<Box<dyn Connection>>> {
todo!()
}
fn get_metadata(&self) -> Box<dyn ConnectionFactoryMetadata> {
todo!()
}
}
impl ConnectionFactoryProvider for MySqlConnectionFactory {
type C = MySqlConnectionFactory;
fn create(options: ConnectionFactoryOptions) -> Result<Self::C> {
todo!()
}
}
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}