Pre: Move query-pull/errors into query-pull-traits

This commit is contained in:
Grisha Kruglov 2018-08-08 11:01:09 -07:00
parent 055b42af0a
commit 32e57bee7a
11 changed files with 62 additions and 17 deletions

View file

@ -70,6 +70,9 @@ path = "query-projector"
[dependencies.mentat_query_pull] [dependencies.mentat_query_pull]
path = "query-pull" path = "query-pull"
[dependencies.query_pull_traits]
path = "query-pull-traits"
[dependencies.mentat_query_sql] [dependencies.mentat_query_sql]
path = "query-sql" path = "query-sql"

View file

@ -36,6 +36,9 @@ path = "../query-algebrizer"
[dependencies.mentat_query_pull] [dependencies.mentat_query_pull]
path = "../query-pull" path = "../query-pull"
[dependencies.query_pull_traits]
path = "../query-pull-traits"
[dependencies.mentat_query_sql] [dependencies.mentat_query_sql]
path = "../query-sql" path = "../query-sql"

View file

@ -19,7 +19,9 @@ use db_traits::errors::DbError;
use mentat_query::{ use mentat_query::{
PlainSymbol, PlainSymbol,
}; };
use mentat_query_pull; use query_pull_traits::errors::{
PullError,
};
use aggregates::{ use aggregates::{
SimpleAggregationOp, SimpleAggregationOp,
@ -74,7 +76,7 @@ pub enum ProjectorError {
DbError(#[cause] DbError), DbError(#[cause] DbError),
#[fail(display = "{}", _0)] #[fail(display = "{}", _0)]
PullError(#[cause] mentat_query_pull::PullError), PullError(#[cause] PullError),
} }
impl From<rusqlite::Error> for ProjectorError { impl From<rusqlite::Error> for ProjectorError {
@ -89,8 +91,8 @@ impl From<DbError> for ProjectorError {
} }
} }
impl From<mentat_query_pull::PullError> for ProjectorError { impl From<PullError> for ProjectorError {
fn from(error: mentat_query_pull::PullError) -> ProjectorError { fn from(error: PullError) -> ProjectorError {
ProjectorError::PullError(error) ProjectorError::PullError(error)
} }
} }

View file

@ -22,6 +22,7 @@ extern crate mentat_db; // For value conversion.
extern crate mentat_query; extern crate mentat_query;
extern crate mentat_query_algebrizer; extern crate mentat_query_algebrizer;
extern crate mentat_query_pull; extern crate mentat_query_pull;
extern crate query_pull_traits;
extern crate mentat_query_sql; extern crate mentat_query_sql;
extern crate mentat_sql; extern crate mentat_sql;

View file

@ -0,0 +1,18 @@
[package]
name = "query_pull_traits"
version = "0.0.1"
workspace = ".."
[lib]
name = "query_pull_traits"
path = "lib.rs"
[dependencies]
failure = "0.1.1"
failure_derive = "0.1.1"
[dependencies.core_traits]
path = "../core-traits"
[dependencies.db_traits]
path = "../db-traits"

18
query-pull-traits/lib.rs Normal file
View 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 db_traits;
pub mod errors;

View file

@ -5,7 +5,9 @@ workspace = ".."
[dependencies] [dependencies]
failure = "0.1.1" failure = "0.1.1"
failure_derive = "0.1.1"
[dependencies.query_pull_traits]
path = "../query-pull-traits"
[dependencies.rusqlite] [dependencies.rusqlite]
version = "0.13" version = "0.13"

View file

@ -58,10 +58,6 @@
///! ``` ///! ```
extern crate failure; extern crate failure;
#[macro_use]
extern crate failure_derive;
extern crate rusqlite; extern crate rusqlite;
extern crate mentat_core; extern crate mentat_core;
@ -69,6 +65,7 @@ extern crate core_traits;
extern crate mentat_db; extern crate mentat_db;
extern crate db_traits; extern crate db_traits;
extern crate mentat_query; extern crate mentat_query;
extern crate query_pull_traits;
extern crate mentat_query_algebrizer; extern crate mentat_query_algebrizer;
extern crate mentat_query_sql; extern crate mentat_query_sql;
extern crate mentat_sql; extern crate mentat_sql;
@ -105,9 +102,7 @@ use mentat_query::{
PullConcreteAttribute, PullConcreteAttribute,
}; };
pub mod errors; use query_pull_traits::errors::{
pub use errors::{
PullError, PullError,
Result, Result,
}; };

View file

@ -30,7 +30,9 @@ use db_traits::errors::DbError;
use mentat_query; use mentat_query;
use mentat_query_algebrizer; use mentat_query_algebrizer;
use mentat_query_projector; use mentat_query_projector;
use mentat_query_pull; use query_pull_traits::errors::{
PullError,
};
use mentat_sql; use mentat_sql;
#[cfg(feature = "syncable")] #[cfg(feature = "syncable")]
@ -107,7 +109,7 @@ pub enum MentatError {
ProjectorError(#[cause] mentat_query_projector::ProjectorError), ProjectorError(#[cause] mentat_query_projector::ProjectorError),
#[fail(display = "{}", _0)] #[fail(display = "{}", _0)]
PullError(#[cause] mentat_query_pull::PullError), PullError(#[cause] PullError),
#[fail(display = "{}", _0)] #[fail(display = "{}", _0)]
SQLError(#[cause] mentat_sql::SQLError), SQLError(#[cause] mentat_sql::SQLError),
@ -153,8 +155,8 @@ impl From<mentat_query_projector::ProjectorError> for MentatError {
} }
} }
impl From<mentat_query_pull::PullError> for MentatError { impl From<PullError> for MentatError {
fn from(error: mentat_query_pull::PullError) -> MentatError { fn from(error: PullError) -> MentatError {
MentatError::PullError(error) MentatError::PullError(error)
} }
} }

View file

@ -30,6 +30,7 @@ extern crate mentat_query;
extern crate mentat_query_algebrizer; extern crate mentat_query_algebrizer;
extern crate mentat_query_projector; extern crate mentat_query_projector;
extern crate mentat_query_pull; extern crate mentat_query_pull;
extern crate query_pull_traits;
extern crate mentat_query_translator; extern crate mentat_query_translator;
extern crate mentat_sql; extern crate mentat_sql;
@ -144,7 +145,7 @@ pub use mentat_query_projector::{
BindingTuple, BindingTuple,
ProjectorError, ProjectorError,
}; };
pub use mentat_query_pull::PullError; pub use query_pull_traits::errors::PullError;
pub use mentat_sql::SQLError; pub use mentat_sql::SQLError;
pub mod conn; pub mod conn;