forked from rust-postgres/rust-postgres
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.rs
More file actions
44 lines (35 loc) · 853 Bytes
/
Copy pathlib.rs
File metadata and controls
44 lines (35 loc) · 853 Bytes
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
// pub trait Connection<'self, R: Rows<'self>> {
// fn query(&self, query: &str, params: &[@ToSqlStr]) -> Result<~R, ~str>;
// }
// pub trait Rows<'self, R: Row, I: Iterator<&'self R>>: Container {
// fn iter(&self) -> I;
// }
// pub trait Row: Container {
// fn get<T: FromSqlStr>(&self) -> Option<T>;
// }
pub trait ToSqlStr {
fn to_sql_str(&self) -> ~str;
}
impl ToSqlStr for int {
fn to_sql_str(&self) -> ~str {
self.to_str()
}
}
impl ToSqlStr for uint {
fn to_sql_str(&self) -> ~str {
self.to_str()
}
}
pub trait FromSqlStr {
fn from_sql_str(&str) -> Option<Self>;
}
impl FromSqlStr for int {
fn from_sql_str(s: &str) -> Option<int> {
FromStr::from_str(s)
}
}
impl FromSqlStr for uint {
fn from_sql_str(s: &str) -> Option<uint> {
FromStr::from_str(s)
}
}