Tutorial
OxiScript — Complete Tutorial
Everything you need to build production-grade stored procedures. Each chapter is self-contained and packed with runnable examples.
Path: If you're brand new, follow it top-to-bottom. If you already know the syntax, jump straight to Recipes.
1. Getting Started
- Install & enable — get OxiDB running and confirm OxiScript is on
- Hello, OxiScript — your first procedure in three lines
- Your first real procedure — read, validate, update, return
2. Language Syntax
- Types & literals — numbers, strings, bools, null, arrays, objects
- Variables (
let) — bindings and scope - Operators — arithmetic, comparison, logical, field access
if/else— conditional branchesfor/inloops — iterating over result sets- Comments — line and block comments
3. Database Operations
find/find_one— querying documentsinsert— creating documentsupdate/update_one— modifying documentsdelete/delete_one— removing documentscount— counting matchesaggregate— pipeline inside a procedure
4. Patterns
- Input validation — guard clauses and friendly errors
- Atomic transactions — the OCC merge rule and how to avoid conflicts
- Procedure composition — calling procs from procs
- Upsert & soft-delete — common idempotency patterns
5. Real-world Recipes
- Banking — transfers, withdrawals, statements
- E-commerce — orders, carts, refunds
- Inventory — stock check, restock, reservations
- Audit log — actor + action + diff
- Rate limiting — atomic counters with TTL
- Leaderboards — top-N with score updates
6. API Reference
- TCP / OxiWire — wire-protocol command list
- REST endpoints — HTTP API
- SDKs — Go, Python, .NET