Move DbResult into its own file

This commit is contained in:
Yuriy Dupyn 2023-12-29 07:49:17 +01:00
parent d87c95f1e1
commit 4f2c864d7a
5 changed files with 9 additions and 5 deletions

View file

@ -1,5 +1,6 @@
use std::collections::HashMap;
use bimap::BiMap;
use crate::result::DbResult;
use crate::operation::{InsertionValues, ColumnSelection};
use crate::internals::row::{Row, ColumnPosition};
use crate::type_system::{DbType, Value, IndexableValue, UUID};
@ -16,11 +17,8 @@ pub struct TableSchema {
}
pub type TableName = String;
pub type ColumnName = String;
pub type DbResult<A> = Result<A, Error>;
impl TableSchema {
fn get_column(&self, column_name: &ColumnName) -> DbResult<(DbType, ColumnPosition)> {
match self.column_name_position_mapping.get_by_left(column_name) {

View file

@ -1,8 +1,9 @@
use std::collections::{BTreeMap, HashMap, HashSet};
use crate::result::DbResult;
use crate::type_system::{UUID, Value, IndexableValue};
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::column_index::ColumnIndex;

View file

@ -1,6 +1,7 @@
use bimap::BiMap;
use crate::result::DbResult;
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::row::{Row, ColumnPosition};
use crate::error::Error;

View file

@ -1,3 +1,4 @@
mod result;
mod internals;
mod operation;
mod interpreter;

3
minisql/src/result.rs Normal file
View file

@ -0,0 +1,3 @@
use crate::error::Error;
pub type DbResult<A> = Result<A, Error>;