Move DbResult into its own file
This commit is contained in:
parent
d87c95f1e1
commit
4f2c864d7a
5 changed files with 9 additions and 5 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use bimap::BiMap;
|
use bimap::BiMap;
|
||||||
|
use crate::result::DbResult;
|
||||||
use crate::operation::{InsertionValues, ColumnSelection};
|
use crate::operation::{InsertionValues, ColumnSelection};
|
||||||
use crate::internals::row::{Row, ColumnPosition};
|
use crate::internals::row::{Row, ColumnPosition};
|
||||||
use crate::type_system::{DbType, Value, IndexableValue, UUID};
|
use crate::type_system::{DbType, Value, IndexableValue, UUID};
|
||||||
|
|
@ -16,11 +17,8 @@ pub struct TableSchema {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type TableName = String;
|
pub type TableName = String;
|
||||||
|
|
||||||
pub type ColumnName = String;
|
pub type ColumnName = String;
|
||||||
|
|
||||||
pub type DbResult<A> = Result<A, Error>;
|
|
||||||
|
|
||||||
impl TableSchema {
|
impl TableSchema {
|
||||||
fn get_column(&self, column_name: &ColumnName) -> DbResult<(DbType, ColumnPosition)> {
|
fn get_column(&self, column_name: &ColumnName) -> DbResult<(DbType, ColumnPosition)> {
|
||||||
match self.column_name_position_mapping.get_by_left(column_name) {
|
match self.column_name_position_mapping.get_by_left(column_name) {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
use std::collections::{BTreeMap, HashMap, HashSet};
|
use std::collections::{BTreeMap, HashMap, HashSet};
|
||||||
|
|
||||||
|
use crate::result::DbResult;
|
||||||
use crate::type_system::{UUID, Value, IndexableValue};
|
use crate::type_system::{UUID, Value, IndexableValue};
|
||||||
use crate::error::Error;
|
use crate::error::Error;
|
||||||
use crate::internals::schema::{TableSchema, ColumnName, DbResult};
|
use crate::internals::schema::{TableSchema, ColumnName};
|
||||||
use crate::internals::row::{Row, ColumnPosition};
|
use crate::internals::row::{Row, ColumnPosition};
|
||||||
use crate::internals::column_index::ColumnIndex;
|
use crate::internals::column_index::ColumnIndex;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
use bimap::BiMap;
|
use bimap::BiMap;
|
||||||
|
use crate::result::DbResult;
|
||||||
use crate::type_system::{Value, DbType, IndexableValue};
|
use crate::type_system::{Value, DbType, IndexableValue};
|
||||||
use crate::internals::schema::{TableName, TableSchema, ColumnName, DbResult};
|
use crate::internals::schema::{TableName, TableSchema, ColumnName};
|
||||||
use crate::internals::table::Table;
|
use crate::internals::table::Table;
|
||||||
use crate::internals::row::{Row, ColumnPosition};
|
use crate::internals::row::{Row, ColumnPosition};
|
||||||
use crate::error::Error;
|
use crate::error::Error;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
mod result;
|
||||||
mod internals;
|
mod internals;
|
||||||
mod operation;
|
mod operation;
|
||||||
mod interpreter;
|
mod interpreter;
|
||||||
|
|
|
||||||
3
minisql/src/result.rs
Normal file
3
minisql/src/result.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
use crate::error::Error;
|
||||||
|
|
||||||
|
pub type DbResult<A> = Result<A, Error>;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue