Rename 'web' module to 'net'

This commit is contained in:
Tobie Morgan Hitchcock 2022-02-09 15:55:04 +00:00
parent 007ab9efbf
commit d0a0065807
18 changed files with 17 additions and 14 deletions

View file

@ -1,5 +1,5 @@
use crate::kvs; use crate::kvs;
use crate::web; use crate::net;
use anyhow::Error; use anyhow::Error;
use clap; use clap;
@ -20,7 +20,7 @@ pub fn init(matches: &clap::ArgMatches) -> Result<(), Error> {
// Start up the kvs storage // Start up the kvs storage
kvs::init(matches)?; kvs::init(matches)?;
// Start up the web server // Start up the web server
web::init(matches)?; net::init(matches)?;
// Don't error when done // Don't error when done
Ok(()) Ok(())
} }

View file

@ -13,8 +13,8 @@ mod err;
mod fnc; mod fnc;
mod key; mod key;
mod kvs; mod kvs;
mod net;
mod sql; mod sql;
mod web;
fn main() { fn main() {
cli::init(); // Initiate the command line cli::init(); // Initiate the command line

View file

@ -1,6 +1,6 @@
use crate::dbs::export; use crate::dbs::export;
use crate::dbs::Session; use crate::dbs::Session;
use crate::web::conf; use crate::net::conf;
use hyper::body::Body; use hyper::body::Body;
use warp::Filter; use warp::Filter;

View file

@ -1,9 +1,9 @@
use crate::dbs::Session; use crate::dbs::Session;
use crate::err::Error; use crate::err::Error;
use crate::net::conf;
use crate::net::head;
use crate::net::output;
use crate::sql::value::Value; use crate::sql::value::Value;
use crate::web::conf;
use crate::web::head;
use crate::web::output;
use bytes::Bytes; use bytes::Bytes;
use serde::Deserialize; use serde::Deserialize;
use std::collections::HashMap; use std::collections::HashMap;
@ -111,8 +111,11 @@ async fn select_all(
l = query.limit.unwrap_or(String::from("100")), l = query.limit.unwrap_or(String::from("100")),
s = query.start.unwrap_or(String::from("0")), s = query.start.unwrap_or(String::from("0")),
); );
let mut vars = HashMap::new(); let vars = hmap! {
vars.insert(String::from("table"), Value::from(table)); String::from("table") => Value::from(table),
};
// let mut vars = HashMap::new();
// vars.insert(String::from("table"), Value::from(table));
match crate::dbs::execute(sql.as_str(), session, Some(vars)).await { match crate::dbs::execute(sql.as_str(), session, Some(vars)).await {
Ok(ref res) => match output.as_ref() { Ok(ref res) => match output.as_ref() {
"application/json" => Ok(output::json(res)), "application/json" => Ok(output::json(res)),

View file

@ -1,4 +1,4 @@
use crate::web::head; use crate::net::head;
use warp::http; use warp::http;
use warp::Filter; use warp::Filter;

View file

@ -1,4 +1,4 @@
use crate::web::head; use crate::net::head;
use warp::http; use warp::http;
use warp::Filter; use warp::Filter;

View file

@ -1,7 +1,7 @@
use crate::dbs::Session; use crate::dbs::Session;
use crate::web::conf; use crate::net::conf;
use crate::web::head; use crate::net::head;
use crate::web::output; use crate::net::output;
use bytes::Bytes; use bytes::Bytes;
use futures::{FutureExt, StreamExt}; use futures::{FutureExt, StreamExt};
use warp::Filter; use warp::Filter;