Pre: Move query-algebrizer/error.rs into query-algebrizer-traits
This commit is contained in:
parent
9fd198f96a
commit
ccdd17551a
26 changed files with 85 additions and 31 deletions
|
@ -61,6 +61,9 @@ path = "db-traits"
|
|||
[dependencies.mentat_query_algebrizer]
|
||||
path = "query-algebrizer"
|
||||
|
||||
[dependencies.query_algebrizer_traits]
|
||||
path = "query-algebrizer-traits"
|
||||
|
||||
[dependencies.mentat_query_projector]
|
||||
path = "query-projector"
|
||||
|
||||
|
|
18
query-algebrizer-traits/Cargo.toml
Normal file
18
query-algebrizer-traits/Cargo.toml
Normal file
|
@ -0,0 +1,18 @@
|
|||
[package]
|
||||
name = "query_algebrizer_traits"
|
||||
version = "0.0.1"
|
||||
workspace = ".."
|
||||
|
||||
[lib]
|
||||
name = "query_algebrizer_traits"
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
failure = "0.1.1"
|
||||
failure_derive = "0.1.1"
|
||||
|
||||
[dependencies.edn]
|
||||
path = "../edn"
|
||||
|
||||
[dependencies.core_traits]
|
||||
path = "../core-traits"
|
18
query-algebrizer-traits/lib.rs
Normal file
18
query-algebrizer-traits/lib.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
// Copyright 2018 Mozilla
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
// this file except in compliance with the License. You may obtain a copy of the
|
||||
// License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software distributed
|
||||
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations under the License.
|
||||
|
||||
extern crate failure;
|
||||
#[macro_use]
|
||||
extern crate failure_derive;
|
||||
|
||||
extern crate core_traits;
|
||||
extern crate edn;
|
||||
|
||||
pub mod errors;
|
|
@ -5,7 +5,6 @@ workspace = ".."
|
|||
|
||||
[dependencies]
|
||||
failure = "0.1.1"
|
||||
failure_derive = "0.1.1"
|
||||
|
||||
[dependencies.edn]
|
||||
path = "../edn"
|
||||
|
@ -16,5 +15,8 @@ path = "../core"
|
|||
[dependencies.core_traits]
|
||||
path = "../core-traits"
|
||||
|
||||
[dependencies.query_algebrizer_traits]
|
||||
path = "../query-algebrizer-traits"
|
||||
|
||||
[dev-dependencies]
|
||||
itertools = "0.7"
|
||||
|
|
|
@ -30,7 +30,7 @@ use clauses::{
|
|||
ConjoiningClauses,
|
||||
};
|
||||
|
||||
use errors::{
|
||||
use query_algebrizer_traits::errors::{
|
||||
AlgebrizerError,
|
||||
Result,
|
||||
};
|
||||
|
|
|
@ -32,7 +32,7 @@ use clauses::{
|
|||
ConjoiningClauses,
|
||||
};
|
||||
|
||||
use errors::{
|
||||
use query_algebrizer_traits::errors::{
|
||||
AlgebrizerError,
|
||||
BindingError,
|
||||
Result,
|
||||
|
|
|
@ -33,7 +33,7 @@ use clauses::{
|
|||
|
||||
use clauses::convert::ValueConversion;
|
||||
|
||||
use errors::{
|
||||
use query_algebrizer_traits::errors::{
|
||||
AlgebrizerError,
|
||||
BindingError,
|
||||
Result,
|
||||
|
|
|
@ -19,7 +19,7 @@ use edn::query::{
|
|||
Variable,
|
||||
};
|
||||
|
||||
use errors::{
|
||||
use query_algebrizer_traits::errors::{
|
||||
AlgebrizerError,
|
||||
Result,
|
||||
};
|
||||
|
|
|
@ -52,7 +52,7 @@ use edn::query::{
|
|||
PatternNonValuePlace,
|
||||
};
|
||||
|
||||
use errors::{
|
||||
use query_algebrizer_traits::errors::{
|
||||
AlgebrizerError,
|
||||
Result,
|
||||
};
|
||||
|
|
|
@ -16,7 +16,7 @@ use edn::query::{
|
|||
|
||||
use clauses::ConjoiningClauses;
|
||||
|
||||
use errors::{
|
||||
use query_algebrizer_traits::errors::{
|
||||
AlgebrizerError,
|
||||
Result,
|
||||
};
|
||||
|
@ -113,7 +113,7 @@ mod testing {
|
|||
associate_ident,
|
||||
};
|
||||
|
||||
use errors::{
|
||||
use query_algebrizer_traits::errors::{
|
||||
AlgebrizerError,
|
||||
};
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ use clauses::{
|
|||
PushComputed,
|
||||
};
|
||||
|
||||
use errors::{
|
||||
use query_algebrizer_traits::errors::{
|
||||
Result,
|
||||
};
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ use clauses::ConjoiningClauses;
|
|||
|
||||
use clauses::convert::ValueTypes;
|
||||
|
||||
use errors::{
|
||||
use query_algebrizer_traits::errors::{
|
||||
AlgebrizerError,
|
||||
Result,
|
||||
};
|
||||
|
|
|
@ -26,7 +26,7 @@ use edn::query::{
|
|||
|
||||
use clauses::ConjoiningClauses;
|
||||
|
||||
use errors::{
|
||||
use query_algebrizer_traits::errors::{
|
||||
AlgebrizerError,
|
||||
Result,
|
||||
};
|
||||
|
|
|
@ -24,7 +24,7 @@ use clauses::{
|
|||
ConjoiningClauses,
|
||||
};
|
||||
|
||||
use errors::{
|
||||
use query_algebrizer_traits::errors::{
|
||||
AlgebrizerError,
|
||||
BindingError,
|
||||
Result,
|
||||
|
|
|
@ -16,7 +16,7 @@ use clauses::{
|
|||
ConjoiningClauses,
|
||||
};
|
||||
|
||||
use errors::{
|
||||
use query_algebrizer_traits::errors::{
|
||||
AlgebrizerError,
|
||||
Result,
|
||||
};
|
||||
|
|
|
@ -10,18 +10,16 @@
|
|||
|
||||
extern crate failure;
|
||||
|
||||
#[macro_use] extern crate failure_derive;
|
||||
|
||||
extern crate edn;
|
||||
extern crate mentat_core;
|
||||
extern crate core_traits;
|
||||
#[macro_use]
|
||||
extern crate query_algebrizer_traits;
|
||||
|
||||
use std::collections::BTreeSet;
|
||||
use std::ops::Sub;
|
||||
use std::rc::Rc;
|
||||
|
||||
#[macro_use]
|
||||
mod errors;
|
||||
mod types;
|
||||
mod validate;
|
||||
mod clauses;
|
||||
|
@ -51,9 +49,8 @@ use edn::query::{
|
|||
WhereClause,
|
||||
};
|
||||
|
||||
pub use errors::{
|
||||
use query_algebrizer_traits::errors::{
|
||||
AlgebrizerError,
|
||||
BindingError,
|
||||
Result,
|
||||
};
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ use edn::query::{
|
|||
UnifyVars,
|
||||
};
|
||||
|
||||
use errors::{
|
||||
use query_algebrizer_traits::errors::{
|
||||
AlgebrizerError,
|
||||
Result,
|
||||
};
|
||||
|
|
|
@ -12,6 +12,7 @@ extern crate edn;
|
|||
extern crate mentat_core;
|
||||
extern crate core_traits;
|
||||
extern crate mentat_query_algebrizer;
|
||||
extern crate query_algebrizer_traits;
|
||||
|
||||
mod utils;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ extern crate edn;
|
|||
extern crate mentat_core;
|
||||
extern crate core_traits;
|
||||
extern crate mentat_query_algebrizer;
|
||||
extern crate query_algebrizer_traits;
|
||||
|
||||
mod utils;
|
||||
|
||||
|
@ -33,9 +34,12 @@ use edn::query::{
|
|||
Variable,
|
||||
};
|
||||
|
||||
use mentat_query_algebrizer::{
|
||||
use query_algebrizer_traits::errors::{
|
||||
AlgebrizerError,
|
||||
BindingError,
|
||||
};
|
||||
|
||||
use mentat_query_algebrizer::{
|
||||
ComputedTable,
|
||||
Known,
|
||||
QueryInputs,
|
||||
|
|
|
@ -12,6 +12,7 @@ extern crate edn;
|
|||
extern crate mentat_core;
|
||||
extern crate core_traits;
|
||||
extern crate mentat_query_algebrizer;
|
||||
extern crate query_algebrizer_traits;
|
||||
|
||||
mod utils;
|
||||
|
||||
|
@ -34,8 +35,11 @@ use edn::query::{
|
|||
Variable,
|
||||
};
|
||||
|
||||
use mentat_query_algebrizer::{
|
||||
use query_algebrizer_traits::errors::{
|
||||
AlgebrizerError,
|
||||
};
|
||||
|
||||
use mentat_query_algebrizer::{
|
||||
EmptyBecause,
|
||||
Known,
|
||||
QueryInputs,
|
||||
|
|
|
@ -12,6 +12,7 @@ extern crate edn;
|
|||
extern crate core_traits;
|
||||
extern crate mentat_core;
|
||||
extern crate mentat_query_algebrizer;
|
||||
extern crate query_algebrizer_traits;
|
||||
|
||||
mod utils;
|
||||
|
||||
|
|
|
@ -27,8 +27,11 @@ use edn::query::{
|
|||
Keyword,
|
||||
};
|
||||
|
||||
use mentat_query_algebrizer::{
|
||||
use query_algebrizer_traits::errors::{
|
||||
AlgebrizerError,
|
||||
};
|
||||
|
||||
use mentat_query_algebrizer::{
|
||||
ConjoiningClauses,
|
||||
Known,
|
||||
QueryInputs,
|
||||
|
|
|
@ -27,7 +27,9 @@ use mentat_core::{
|
|||
};
|
||||
|
||||
use db_traits::errors::DbError;
|
||||
use mentat_query_algebrizer;
|
||||
use query_algebrizer_traits::errors::{
|
||||
AlgebrizerError,
|
||||
};
|
||||
use mentat_query_projector;
|
||||
use query_pull_traits::errors::{
|
||||
PullError,
|
||||
|
@ -102,7 +104,7 @@ pub enum MentatError {
|
|||
DbError(#[cause] DbError),
|
||||
|
||||
#[fail(display = "{}", _0)]
|
||||
AlgebrizerError(#[cause] mentat_query_algebrizer::AlgebrizerError),
|
||||
AlgebrizerError(#[cause] AlgebrizerError),
|
||||
|
||||
#[fail(display = "{}", _0)]
|
||||
ProjectorError(#[cause] mentat_query_projector::ProjectorError),
|
||||
|
@ -142,8 +144,8 @@ impl From<DbError> for MentatError {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<mentat_query_algebrizer::AlgebrizerError> for MentatError {
|
||||
fn from(error: mentat_query_algebrizer::AlgebrizerError) -> MentatError {
|
||||
impl From<AlgebrizerError> for MentatError {
|
||||
fn from(error: AlgebrizerError) -> MentatError {
|
||||
MentatError::AlgebrizerError(error)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ extern crate core_traits;
|
|||
extern crate mentat_db;
|
||||
extern crate db_traits;
|
||||
extern crate mentat_query_algebrizer;
|
||||
extern crate query_algebrizer_traits;
|
||||
extern crate mentat_query_projector;
|
||||
extern crate mentat_query_pull;
|
||||
extern crate query_pull_traits;
|
||||
|
@ -139,7 +140,7 @@ pub use edn::{
|
|||
ToMicros,
|
||||
ToMillis,
|
||||
};
|
||||
pub use mentat_query_algebrizer::AlgebrizerError;
|
||||
pub use query_algebrizer_traits::errors::AlgebrizerError;
|
||||
pub use mentat_query_projector::{
|
||||
BindingTuple,
|
||||
ProjectorError,
|
||||
|
|
|
@ -18,7 +18,7 @@ extern crate core_traits;
|
|||
extern crate mentat_db;
|
||||
|
||||
// TODO: when we switch to `failure`, make this more humane.
|
||||
extern crate mentat_query_algebrizer; // For errors.
|
||||
extern crate query_algebrizer_traits; // For errors;
|
||||
extern crate mentat_query_projector; // For errors.
|
||||
extern crate mentat_query_translator; // For errors.
|
||||
|
||||
|
@ -416,7 +416,7 @@ fn test_fulltext() {
|
|||
]"#;
|
||||
let r = conn.q_once(&mut c, query, None);
|
||||
match r.expect_err("expected query to fail") {
|
||||
MentatError::AlgebrizerError(mentat_query_algebrizer::AlgebrizerError::InvalidArgument(PlainSymbol(s), ty, i)) => {
|
||||
MentatError::AlgebrizerError(query_algebrizer_traits::errors::AlgebrizerError::InvalidArgument(PlainSymbol(s), ty, i)) => {
|
||||
assert_eq!(s, "fulltext");
|
||||
assert_eq!(ty, "string");
|
||||
assert_eq!(i, 2);
|
||||
|
@ -431,7 +431,7 @@ fn test_fulltext() {
|
|||
[(fulltext $ :foo/fts ?a) [[?x ?val]]]]"#;
|
||||
let r = conn.q_once(&mut c, query, None);
|
||||
match r.expect_err("expected query to fail") {
|
||||
MentatError::AlgebrizerError(mentat_query_algebrizer::AlgebrizerError::InvalidArgument(PlainSymbol(s), ty, i)) => {
|
||||
MentatError::AlgebrizerError(query_algebrizer_traits::errors::AlgebrizerError::InvalidArgument(PlainSymbol(s), ty, i)) => {
|
||||
assert_eq!(s, "fulltext");
|
||||
assert_eq!(ty, "string");
|
||||
assert_eq!(i, 2);
|
||||
|
|
Loading…
Reference in a new issue