Cleaned up the testing.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 2s
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 2s
This commit is contained in:
parent
d06c228c81
commit
97df1a8ece
17
src/lib.rs
17
src/lib.rs
@ -1,15 +1,11 @@
|
|||||||
mod message;
|
mod message;
|
||||||
|
|
||||||
use message::{
|
use message::{
|
||||||
Action, Addition, CalcValue, Calculation, Clock, CreateDoc, Delete, DocDef, DocFuncType, Field,
|
Action, Addition, CalcValue, Calculation, Clock, CreateDoc, Field, FieldType, Include, Message,
|
||||||
FieldType, Include, IndexType, Message, Name, NameType, Operand, Path, Queue, RegMsg, Register,
|
Name, NameType, Operand, Path, Queue, RegMsg, Register, Session,
|
||||||
Session, Update,
|
|
||||||
};
|
};
|
||||||
pub use message::{MsgAction, Query};
|
pub use message::{MsgAction, Query};
|
||||||
use std::{
|
use std::sync::mpsc::{channel, Receiver};
|
||||||
sync::mpsc::{channel, Receiver},
|
|
||||||
time::Duration,
|
|
||||||
};
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
@ -19,7 +15,7 @@ pub struct MoreThanText {
|
|||||||
|
|
||||||
impl MoreThanText {
|
impl MoreThanText {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let mut queue = Queue::new();
|
let queue = Queue::new();
|
||||||
Clock::start(queue.clone());
|
Clock::start(queue.clone());
|
||||||
CreateDoc::start(queue.clone());
|
CreateDoc::start(queue.clone());
|
||||||
let session = Session::new();
|
let session = Session::new();
|
||||||
@ -62,8 +58,9 @@ impl MoreThanText {
|
|||||||
Ok(id) => {
|
Ok(id) => {
|
||||||
let mut query = Query::new();
|
let mut query = Query::new();
|
||||||
let mut calc = Calculation::new(Operand::Equal);
|
let mut calc = Calculation::new(Operand::Equal);
|
||||||
calc.add_value(CalcValue::Existing(FieldType::Uuid));
|
calc.add_value(CalcValue::Existing(FieldType::Uuid))
|
||||||
calc.add_value(id);
|
.unwrap();
|
||||||
|
calc.add_value(id).unwrap();
|
||||||
query.add(Name::english("id"), calc);
|
query.add(Name::english("id"), calc);
|
||||||
query.into()
|
query.into()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,6 +52,7 @@ async fn create_app(state: MoreThanText) -> Router {
|
|||||||
.with_state(state)
|
.with_state(state)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct SessionID(Uuid);
|
struct SessionID(Uuid);
|
||||||
|
|
||||||
@ -82,21 +83,21 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn mtt_conn(
|
async fn mtt_conn(
|
||||||
sess_id: SessionID,
|
_sess_id: SessionID,
|
||||||
method: Method,
|
method: Method,
|
||||||
path: Path<HashMap<String, String>>,
|
path: Path<HashMap<String, String>>,
|
||||||
state: State<MoreThanText>,
|
state: State<MoreThanText>,
|
||||||
body: String,
|
_body: String,
|
||||||
) -> impl IntoResponse {
|
) -> impl IntoResponse {
|
||||||
let (tx, mut rx) = channel(1);
|
let (tx, mut rx) = channel(1);
|
||||||
let action = match method {
|
let _action = match method {
|
||||||
Method::GET => MsgAction::Query(Query::new()),
|
Method::GET => MsgAction::Query(Query::new()),
|
||||||
//Method::GET => ActionType::Get,
|
//Method::GET => ActionType::Get,
|
||||||
//Method::POST => ActionType::Add,
|
//Method::POST => ActionType::Add,
|
||||||
//Method::PATCH => ActionType::Update,
|
//Method::PATCH => ActionType::Update,
|
||||||
_ => unreachable!("reouter should prevent this"),
|
_ => unreachable!("reouter should prevent this"),
|
||||||
};
|
};
|
||||||
let doc = match path.get("document") {
|
let _doc = match path.get("document") {
|
||||||
Some(result) => result.clone(),
|
Some(result) => result.clone(),
|
||||||
None => "root".to_string(),
|
None => "root".to_string(),
|
||||||
};
|
};
|
||||||
|
|||||||
414
src/message.rs
414
src/message.rs
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user