| Ocalt Query Language
Pricing Dashboard ocalt.com v1.0

Compute & Crypto

Mathematical expressions, type conversion, UUID generation, cryptographic hashing, encryption, signing, and constant-time comparison.

VerbDescription
CALCULATE "expr"Evaluate a mathematical expression string
CAST ?val AS "type"Convert type: text, number, boolean, json
UUIDGenerate a UUID v4
RANDOMRandom float 0–1
HASH "text" USING "algo"Cryptographic hash
ENCRYPT "text" WITH "key" USING "algo"Encrypt data
DECRYPT "text" WITH "key" USING "algo"Decrypt data
SIGN "text" USING "algo" WITH "secret"Sign / create JWT
VERIFY "token" USING "algo" WITH "secret"Verify / decode JWT
COMPARE "a" WITH "b"Constant-time string comparison — returns boolean. Safe for secrets.

CALCULATE

Evaluates a math expression string. Reference query variables inside the expression with ?var.

CALCULATE "pow(2,10) + sqrt(144)" SET ?r AFTER EMIT ?r (* → 1036 *)
Try it ›
CALCULATE "100" SET ?price AFTER CALCULATE "?price * 1.15" SET ?with_tax AFTER EMIT ?with_tax
Try it ›
FunctionDescription
abs, ceil, floor, roundStandard rounding
sqrt, pow, log, log2, log10Powers and logarithms
sin, cos, tan, asin, acos, atan, atan2Trigonometry
min, maxMin/max of two values
PI, EMathematical constants

CAST

CAST "42" AS "number" SET ?n AFTER CALCULATE "?n * 2" SET ?r AFTER EMIT ?r
Try it ›
CAST 3.14 AS "text" SET ?s AFTER EMIT "Pi is approximately " & ?s
CAST "true" AS "boolean" SET ?b AFTER IF ?b IS EQUAL TO true OPEN NEST EMIT "it is true" CLOSE NEST
(* Serialize any value to a JSON string *) NEW JSON OBJECT OPEN NEST SET "x" AS 1 AND SET "y" AS 2 CLOSE NEST SET ?obj AFTER CAST ?obj AS "json" SET ?json_str AFTER EMIT ?json_str

UUID / RANDOM

UUID SET ?id AFTER EMIT ?id (* → "550e8400-e29b-41d4-a716-446655440000" *) RANDOM SET ?n AFTER EMIT ?n (* → 0.7341... *)
Try it ›

HASH

AlgorithmUSING value
SHA-256"SHA256"
SHA-512"SHA512"
MD5"MD5"
bcrypt (passwords)"BCRYPT" — slow, salted; use for passwords
HMAC-SHA256"HMAC-SHA256" — requires WITH "secret"
HASH "password123" USING "BCRYPT" SET ?hashed AFTER EMIT ?hashed
Try it ›
HASH "message" USING "HMAC-SHA256" WITH "secret-key" SET ?sig AFTER EMIT ?sig

ENCRYPT / DECRYPT

ENCRYPT "sensitive data" WITH "my-32-byte-secret-key-padded!!" USING "AES256" SET ?enc AFTER DECRYPT ?enc WITH "my-32-byte-secret-key-padded!!" USING "AES256" SET ?dec AFTER EMIT ?dec

SIGN / VERIFY (JWT)

NEW JSON OBJECT OPEN NEST SET "uid" AS "42" AND SET "role" AS "admin" CLOSE NEST SET ?payload AFTER SIGN ?payload USING "HS256" WITH "my-jwt-secret" SET ?token AFTER EMIT ?token
VERIFY ?token USING "HS256" WITH "my-jwt-secret" SET ?claims AFTER EMIT ?claims(uid)

COMPARE — constant-time comparison

Use COMPARE when comparing secrets, tokens, or signatures. It runs in constant time regardless of the length of the match, preventing timing attacks.

COMPARE ?submitted_token WITH ?stored_token SET ?valid AFTER IF ?valid IS EQUAL TO true OPEN NEST EMIT "token accepted" CLOSE NEST ELSE OPEN NEST STATUS 401 CLOSE NEST

CATCH ERROR — handle verb failures inline

CATCH ERROR SET ?err intercepts the most recent error into a variable without halting the query. If no error occurred ?err is null. See Error Codes for full documentation.

FETCH "https://api.example.com/data" SET ?data CATCH ERROR SET ?err AFTER IF ?err IS NOT NULL OPEN NEST EMIT "failed: " & ?err CLOSE NEST ELSE OPEN NEST EMIT ?data CLOSE NEST
Try it ›