VQL is a comprehensive framework for interacting with ValtheraDB. It provides dual query syntaxes, advanced relation handling, and an integrated permission system.
_me, _user, _now) and custom variablesimport VQLProcessor from "@wxn0brp/vql";
import { Valthera } from "@wxn0brp/db";
const db = new Valthera("./data/my-db");
const processor = new VQLProcessor({ main: db });
// VQLS
const result1 = await processor.execute(`main users s.status="active" e.name=1`);
// VQLR
const result2 = await processor.execute({
db: "main",
d: { find: { collection: "users", search: { status: "active" }, select: ["name"] } }
});
// With variables
const result3 = await processor.execute({
query: `main ~users! s.role=$role u.lastLogin=$_now`,
var: { role: "admin" }
}, userContext);
import VQLProcessor, { VQLConfig } from "@wxn0brp/vql";
const processor = new VQLProcessor(
dbInstances, // Record<string, ValtheraCompatible>
config, // VQLConfig (optional)
permValidFn // Permission function (optional)
);
const result = await processor.execute(query, user);
const config = new VQLConfig({
noCheckPermissions: true, // Default: true (permissions disabled)
strictSelect: false, // Empty select = no filtering (true = no fields)
strictACL: false, // Fallback to parent path on 404
hidePath: false, // Show actual paths in errors
permissionDeniedIfNoUser: true // Deny if no user context
});
r or db+d keys)$var, {__: "var"})