From c3b2b14221ba9929615baf71f9fd5f682750f159 Mon Sep 17 00:00:00 2001 From: Andy Grove Date: Mon, 20 Jan 2020 08:42:35 -0700 Subject: [PATCH] Use Stream in API --- Cargo.toml | 6 +++--- rdbc/Cargo.toml | 1 + rdbc/src/lib.rs | 8 +++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 51aeef1..769cd1e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,9 +2,9 @@ members = [ "rdbc", - "rdbc-mysql", - "rdbc-postgres", - "rdbc-sqlite", +# "rdbc-mysql", +# "rdbc-postgres", +# "rdbc-sqlite", # "rdbc-odbc", "rdbc-cli", ] diff --git a/rdbc/Cargo.toml b/rdbc/Cargo.toml index cf67701..a869b50 100644 --- a/rdbc/Cargo.toml +++ b/rdbc/Cargo.toml @@ -7,3 +7,4 @@ license = "Apache-2.0" edition = "2018" [dependencies] +tokio = { version="0.2.9", features=["full"] } \ No newline at end of file diff --git a/rdbc/src/lib.rs b/rdbc/src/lib.rs index 3dceb18..ad1122d 100644 --- a/rdbc/src/lib.rs +++ b/rdbc/src/lib.rs @@ -19,6 +19,8 @@ //! } //! ``` +use tokio::stream::Stream; + /// RDBC Error #[derive(Debug)] pub enum Error { @@ -74,12 +76,16 @@ pub trait Statement { /// Result set from executing a query against a statement pub trait ResultSet { + type RowsStream: Stream; + /// get meta data about this result set fn meta_data(&self) -> Result>; /// Move the cursor to the next available row if one exists and return true if it does - fn next(&mut self) -> bool; + fn rows(&mut self) -> Result; +} +trait Row { fn get_i8(&self, i: u64) -> Result>; fn get_i16(&self, i: u64) -> Result>; fn get_i32(&self, i: u64) -> Result>;