Production deployment with zinit config
This commit is contained in:
54
examples/osiris_script.rhai
Normal file
54
examples/osiris_script.rhai
Normal file
@@ -0,0 +1,54 @@
|
||||
// OSIRIS Rhai Script Example
|
||||
// This script demonstrates creating and storing OSIRIS objects
|
||||
|
||||
print("=== OSIRIS Rhai Script Example ===\n");
|
||||
|
||||
// Create a note with fluent builder pattern
|
||||
print("Creating a note...");
|
||||
let note = note("notes")
|
||||
.title("My First Rhai Note")
|
||||
.content("This note was created from a Rhai script using the OSIRIS engine!")
|
||||
.tag("source", "rhai")
|
||||
.tag("project", "osiris")
|
||||
.tag("priority", "high")
|
||||
.mime("text/plain");
|
||||
|
||||
print(`Note created: ${note.get_title()}`);
|
||||
|
||||
// Store the note in HeroDB
|
||||
print("Storing note...");
|
||||
let note_id = put_note(note);
|
||||
print(`✓ Note stored with ID: ${note_id}\n`);
|
||||
|
||||
// Retrieve the note
|
||||
print("Retrieving note...");
|
||||
let retrieved_note = get_note("notes", note_id);
|
||||
print(`✓ Retrieved: ${retrieved_note.get_title()}`);
|
||||
print(` Content: ${retrieved_note.get_content()}\n`);
|
||||
|
||||
// Create an event
|
||||
print("Creating an event...");
|
||||
let event = event("calendar", "Team Meeting")
|
||||
.description("Weekly team sync")
|
||||
.location("Conference Room A")
|
||||
.category("meetings")
|
||||
.all_day(false);
|
||||
|
||||
print(`Event created: ${event.get_title()}`);
|
||||
|
||||
// Store the event
|
||||
print("Storing event...");
|
||||
let event_id = put_event(event);
|
||||
print(`✓ Event stored with ID: ${event_id}\n`);
|
||||
|
||||
// Query notes by tag
|
||||
print("Querying notes by tag (project=osiris)...");
|
||||
let ids = query("notes", "tags:tag", "project=osiris");
|
||||
print(`✓ Found ${ids.len()} note(s) with tag project=osiris`);
|
||||
|
||||
for id in ids {
|
||||
let n = get_note("notes", id);
|
||||
print(` - ${n.get_title()}`);
|
||||
}
|
||||
|
||||
print("\n=== Script completed successfully! ===");
|
||||
Reference in New Issue
Block a user