From 6a8c53b51e516818e83dee4731d1828170d38d3c Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Tue, 3 May 2022 17:47:47 +0100 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20use=20custom=20type=20definitio?= =?UTF-8?q?n=20for=20query=20responses?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/src/dbs/dbs.rs | 6 +++--- lib/src/dbs/executor.rs | 4 ++-- lib/src/dbs/response.rs | 2 -- lib/src/lib.rs | 1 - 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/src/dbs/dbs.rs b/lib/src/dbs/dbs.rs index 0ed206e9..7ecb43a7 100644 --- a/lib/src/dbs/dbs.rs +++ b/lib/src/dbs/dbs.rs @@ -1,7 +1,7 @@ use crate::dbs::Attach; use crate::dbs::Executor; use crate::dbs::Options; -use crate::dbs::Responses; +use crate::dbs::Response; use crate::dbs::Session; use crate::dbs::Variables; use crate::err::Error; @@ -15,7 +15,7 @@ pub async fn execute( txt: &str, session: Session, vars: Variables, -) -> Result { +) -> Result, Error> { // Create a new query options let mut opt = Options::default(); // Create a new query executor @@ -38,7 +38,7 @@ pub async fn process( ast: Query, session: Session, vars: Variables, -) -> Result { +) -> Result, Error> { // Create a new query options let mut opt = Options::default(); // Create a new query executor diff --git a/lib/src/dbs/executor.rs b/lib/src/dbs/executor.rs index 488692e2..5a9a1c81 100644 --- a/lib/src/dbs/executor.rs +++ b/lib/src/dbs/executor.rs @@ -1,5 +1,5 @@ use crate::ctx::Context; -use crate::dbs::response::{Response, Responses}; +use crate::dbs::response::Response; use crate::dbs::Auth; use crate::dbs::Level; use crate::dbs::Options; @@ -120,7 +120,7 @@ impl Executor { mut ctx: Runtime, mut opt: Options, qry: Query, - ) -> Result { + ) -> Result, Error> { // Initialise buffer of responses let mut buf: Vec = vec![]; // Initialise array of responses diff --git a/lib/src/dbs/response.rs b/lib/src/dbs/response.rs index 1f8dd5af..e2d5d193 100644 --- a/lib/src/dbs/response.rs +++ b/lib/src/dbs/response.rs @@ -4,8 +4,6 @@ use serde::ser::SerializeStruct; use serde::Serialize; use std::time::Duration; -pub type Responses = Vec; - #[derive(Debug)] pub struct Response { pub sql: Option, diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 0cfcab49..9c51a847 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -23,7 +23,6 @@ pub use dbs::execute; pub use dbs::process; pub use dbs::Auth; pub use dbs::Response; -pub use dbs::Responses; pub use dbs::Session; pub use kvs::Datastore;