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::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<Responses, Error> {
) -> Result<Vec<Response>, 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<Responses, Error> {
) -> Result<Vec<Response>, Error> {
// Create a new query options
let mut opt = Options::default();
// Create a new query executor

View file

@ -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<Responses, Error> {
) -> Result<Vec<Response>, Error> {
// Initialise buffer of responses
let mut buf: Vec<Response> = vec![];
// Initialise array of responses

View file

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

View file

@ -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;