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
23 lines (18 loc) · 691 Bytes
/
Copy pathlib.rs
File metadata and controls
23 lines (18 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
pub trait SqlConnection<Row, It, Res, S: SqlStatement<Row, It, Res>> {
fn new(uri: &str) -> Result<~Self, ~str>;
fn prepare<'a>(&'a self, query: &str) -> Result<~S, ~str>;
}
pub trait SqlStatement<Row, It, R: SqlResult<Row, It>> {
fn query<T>(&self, params: &[~str], blk: &fn(&R) -> Result<T, ~str>)
-> Result<T, ~str>;
fn update(&self, params: &[~str]) -> Result<uint, ~str>;
}
pub trait SqlResult<R: SqlRow, I: Iterator<R>>: Container {
fn iter(&self) -> I;
}
pub trait SqlRow: Container {
fn get<T: FromSql<Self>>(&self, index: uint) -> Option<T>;
}
pub trait FromSql<R/*: SqlRow*/> {
fn from_sql(row: &R, column: uint) -> Option<Self>;
}