Don’t use custom type definition for query responses

This commit is contained in:
Tobie Morgan Hitchcock 2022-05-03 17:47:47 +01:00
parent 01ab9375a3
commit 6a8c53b51e
4 changed files with 5 additions and 8 deletions

View file

@ -1,7 +1,7 @@
use crate::dbs::Attach; use crate::dbs::Attach;
use crate::dbs::Executor; use crate::dbs::Executor;
use crate::dbs::Options; use crate::dbs::Options;
use crate::dbs::Responses; use crate::dbs::Response;
use crate::dbs::Session; use crate::dbs::Session;
use crate::dbs::Variables; use crate::dbs::Variables;
use crate::err::Error; use crate::err::Error;
@ -15,7 +15,7 @@ pub async fn execute(
txt: &str, txt: &str,
session: Session, session: Session,
vars: Variables, vars: Variables,
) -> Result<Responses, Error> { ) -> Result<Vec<Response>, Error> {
// Create a new query options // Create a new query options
let mut opt = Options::default(); let mut opt = Options::default();
// Create a new query executor // Create a new query executor
@ -38,7 +38,7 @@ pub async fn process(
ast: Query, ast: Query,
session: Session, session: Session,
vars: Variables, vars: Variables,
) -> Result<Responses, Error> { ) -> Result<Vec<Response>, Error> {
// Create a new query options // Create a new query options
let mut opt = Options::default(); let mut opt = Options::default();
// Create a new query executor // Create a new query executor

View file

@ -1,5 +1,5 @@
use crate::ctx::Context; use crate::ctx::Context;
use crate::dbs::response::{Response, Responses}; use crate::dbs::response::Response;
use crate::dbs::Auth; use crate::dbs::Auth;
use crate::dbs::Level; use crate::dbs::Level;
use crate::dbs::Options; use crate::dbs::Options;
@ -120,7 +120,7 @@ impl Executor {
mut ctx: Runtime, mut ctx: Runtime,
mut opt: Options, mut opt: Options,
qry: Query, qry: Query,
) -> Result<Responses, Error> { ) -> Result<Vec<Response>, Error> {
// Initialise buffer of responses // Initialise buffer of responses
let mut buf: Vec<Response> = vec![]; let mut buf: Vec<Response> = vec![];
// Initialise array of responses // Initialise array of responses

View file

@ -4,8 +4,6 @@ use serde::ser::SerializeStruct;
use serde::Serialize; use serde::Serialize;
use std::time::Duration; use std::time::Duration;
pub type Responses = Vec<Response>;
#[derive(Debug)] #[derive(Debug)]
pub struct Response { pub struct Response {
pub sql: Option<String>, pub sql: Option<String>,

View file

@ -23,7 +23,6 @@ pub use dbs::execute;
pub use dbs::process; pub use dbs::process;
pub use dbs::Auth; pub use dbs::Auth;
pub use dbs::Response; pub use dbs::Response;
pub use dbs::Responses;
pub use dbs::Session; pub use dbs::Session;
pub use kvs::Datastore; pub use kvs::Datastore;