steel decimal crate with a proper setup, needs so much work to be done to be finished

This commit is contained in:
filipriec
2025-07-04 11:56:21 +02:00
parent 93c67ffa14
commit f4a23be1a2
13 changed files with 1260 additions and 264 deletions

View File

@@ -7,6 +7,7 @@ license = "AGPL-3.0-or-later"
[dependencies]
common = { path = "../common" }
search = { path = "../search" }
steel_decimal = { path = "../steel_decimal" }
anyhow = { workspace = true }
tantivy = { workspace = true }

View File

@@ -3,11 +3,11 @@ use tonic::Status;
use sqlx::{PgPool, Error as SqlxError};
use common::proto::multieko2::table_script::{PostTableScriptRequest, TableScriptResponse};
use serde_json::Value;
use crate::steel::server::syntax_parser::SyntaxParser;
use steel_decimal::SteelDecimal;
const SYSTEM_COLUMNS: &[&str] = &["id", "deleted", "created_at"];
// TODO MAKE SCRIPT PUSH ONLY TO THE EMPTY TABLES
// TODO MAKE SCRIPT PUSH ONLY TO THE EMPTY TABLES
/// Validates the target column and ensures it is not a system column.
/// Returns the column type if valid.
fn validate_target_column(
@@ -68,9 +68,11 @@ pub async fn post_table_script(
)
.map_err(|e| Status::invalid_argument(e))?;
// Parse and transform the script using the syntax parser
let parser = SyntaxParser::new();
let parsed_script = parser.parse(&request.script, &table_def.table_name);
// Use the steel_decimal for script transformation
let steel_decimal = SteelDecimal::new();
// Transform the script using steel_decimal (no context needed for basic transformation)
let parsed_script = steel_decimal.transform(&request.script);
// Insert the script into the database
let script_record = sqlx::query!(