Move TablePosition into schema
This commit is contained in:
parent
a2180a3e32
commit
ec0a4f2510
4 changed files with 5 additions and 6 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use crate::schema::{Column, TableName, TableSchema};
|
||||
use crate::schema::{Column, TableName, TablePosition, TableSchema};
|
||||
use crate::internals::table::Table;
|
||||
use crate::operation::{Operation, Condition};
|
||||
use crate::result::DbResult;
|
||||
|
|
@ -8,7 +8,6 @@ use crate::restricted_row::RestrictedRow;
|
|||
|
||||
// Use `TablePosition` as index
|
||||
pub type Tables = Vec<Table>;
|
||||
pub type TablePosition = usize;
|
||||
|
||||
// ==============Interpreter================
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
use crate::schema::{Column, TableSchema};
|
||||
use crate::schema::{Column, TablePosition, TableSchema};
|
||||
use crate::type_system::Value;
|
||||
use crate::interpreter::TablePosition;
|
||||
|
||||
// Validated operation. Constructed by validation crate.
|
||||
#[derive(Debug, PartialEq)]
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ pub struct TableSchema {
|
|||
}
|
||||
|
||||
pub type TableName = String;
|
||||
pub type TablePosition = usize;
|
||||
pub type ColumnName = String;
|
||||
pub type Column = usize;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use thiserror::Error;
|
|||
use crate::syntax;
|
||||
use crate::syntax::{RawTableSchema, ColumnSchema, RawQuerySyntax};
|
||||
use minisql::operation;
|
||||
use minisql::{operation::Operation, type_system::Value, schema::{TableSchema, ColumnName, TableName}, type_system::DbType, interpreter::{TablePosition, DbSchema}};
|
||||
use minisql::{operation::Operation, type_system::Value, schema::{TableSchema, ColumnName, Column, TableName, TablePosition}, type_system::DbType, interpreter::DbSchema};
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ValidationError {
|
||||
|
|
@ -158,7 +158,7 @@ fn validate_insert(table_name: TableName, insertion_values: syntax::InsertionVal
|
|||
}
|
||||
|
||||
// Check types and prepare for creation of InsertionValues for the interpreter
|
||||
let mut values_map: BTreeMap<_, Value> = BTreeMap::new(); // The reason for using BTreeMap
|
||||
let mut values_map: BTreeMap<Column, Value> = BTreeMap::new(); // The reason for using BTreeMap
|
||||
// instead of HashMap is that we need
|
||||
// to get the values in a vector
|
||||
// sorted by the key.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue