38 lines
1.1 KiB
Rust
38 lines
1.1 KiB
Rust
/// Example: Running OSIRIS Rhai scripts
|
|
///
|
|
/// This example demonstrates how to use the OSIRIS Rhai engine
|
|
/// to execute scripts that create and manipulate OSIRIS objects.
|
|
///
|
|
/// Prerequisites:
|
|
/// - HeroDB running on localhost:6379
|
|
/// - osiris crate added as dependency with rhai-support feature
|
|
///
|
|
/// Run with:
|
|
/// ```bash
|
|
/// cargo run --example osiris_example
|
|
/// ```
|
|
|
|
use runner_rust::engine::osiris::run_osiris_script;
|
|
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
println!("🚀 OSIRIS Rhai Engine Example\n");
|
|
|
|
// Example 1: Inline script
|
|
println!("Example 1: Inline Script");
|
|
println!("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n");
|
|
|
|
let script = r#"
|
|
print("Creating a note from inline script...");
|
|
let note = note("notes");
|
|
print(note);
|
|
"#;
|
|
|
|
run_osiris_script(script, "redis://localhost:6379", 1)?;
|
|
|
|
println!("\n✅ Example completed!");
|
|
println!("\nNote: Full OSIRIS integration requires adding osiris crate");
|
|
println!(" as a dependency with the 'rhai-support' feature enabled.");
|
|
|
|
Ok(())
|
|
}
|