Added document name to query.
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:
@@ -2,6 +2,7 @@ use super::{DocDef, Query, UserAction};
|
||||
use crate::{
|
||||
message::wrapper::{Addition, Delete, Records, Reply, Update},
|
||||
mtterror::MTTError,
|
||||
name::NameType,
|
||||
queue::data_director::Register,
|
||||
};
|
||||
|
||||
@@ -23,6 +24,15 @@ pub enum MsgAction {
|
||||
Update(Update),
|
||||
}
|
||||
|
||||
impl MsgAction {
|
||||
fn doc_name(&self) -> NameType {
|
||||
match self {
|
||||
Self::Query(data) => data.doc_name(),
|
||||
_ => NameType::None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Addition> for MsgAction {
|
||||
fn from(value: Addition) -> Self {
|
||||
MsgAction::Addition(value)
|
||||
@@ -128,10 +138,11 @@ mod msgactions {
|
||||
|
||||
#[test]
|
||||
fn turn_query_into_action() {
|
||||
let value = Query::new();
|
||||
let name = Name::english(Uuid::new_v4().to_string().as_str());
|
||||
let value = Query::new(name.clone());
|
||||
let result: MsgAction = value.into();
|
||||
match result {
|
||||
MsgAction::Query(_) => {}
|
||||
MsgAction::Query(data) => assert_eq!(data.doc_name(), name.into()),
|
||||
_ => unreachable!("Got {:?}: dhould have been query", result),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user