improve and add models

This commit is contained in:
timurgordon
2025-06-12 05:22:17 +03:00
parent c3f6b91aa0
commit 00c4e6a1eb
19 changed files with 1520 additions and 42 deletions

View File

@@ -12,7 +12,6 @@ type RhaiSignatureRequirement = SignatureRequirement;
use crate::db::hero::OurDB;
use crate::db::Collection;
use crate::db::Db;
use heromodels_core::Model;
// Helper to convert i64 from Rhai to u32 for IDs
fn id_from_i64_to_u32(id_i64: i64) -> Result<u32, Box<EvalAltResult>> {
@@ -24,16 +23,6 @@ fn id_from_i64_to_u32(id_i64: i64) -> Result<u32, Box<EvalAltResult>> {
)
}
// Helper to convert i64 from Rhai to u64 for timestamps or other large numbers
fn val_from_i64_to_u64(val_i64: i64) -> Result<u64, Box<EvalAltResult>> {
u64::try_from(val_i64).map_err(|_|
Box::new(EvalAltResult::ErrorArithmetic(
format!("Failed to convert value '{}' to u64", val_i64).into(),
Position::NONE
))
)
}
#[export_module]
mod rhai_flow_module {
// --- Flow Functions ---