NSQL Filter Engine • Language Spec
NSQL Language Specification & AST Grammar
NSQL (Nuncio SQL) compiles declarative filter expressions into typed Rust AST objects executed inside `nunciod` with microsecond latency.
1. Standard NSQL Statement Syntax
CREATE RULE "VIP Priority Route" ON ACCOUNT "james.maes@kof22.com" PRIORITY 10 WHEN sender LIKE '%@kof22.com%' AND (subject REGEXP '(?i)(urgent|security)' OR size_bytes > 5242880) THEN MOVE TO 'vip-inbox', COPY TO 'Archive', SET read = TRUE, CALL WEBHOOK 'https://api.kof22.com/webhook' WITH STOP PROCESSING;
Target Fields
- •
subject: Email subject line header string - •
sender / from: Message sender email address - •
recipient / to: Recipient address string - •
body: Plain text / HTML email body content - •
size_bytes / size: Total byte size of email payload - •
has_attachment: Boolean flag for attachments - •
header['X-Spam']: Custom MIME header key lookup
Action Clauses
- •
MOVE TO 'folder': Relocate to target folder - •
COPY TO 'folder': Copy to target folder - •
SET read = TRUE: Mark email read - •
SET flagged = TRUE: Star / flag message - •
FORWARD TO 'email': Forward message payload - •
CALL WEBHOOK 'url': Trigger HMAC signed POST - •
DELETE: Move message directly to Trash
Microsecond Dry-Run Preview Engine
Before saving or persisting any NSQL rule, execute `nuncio filter test --sql "..."` to run a zero-mutation memory simulation against your 100,000+ message database in under 10ms.