VQL (Valthera Query Language) is a comprehensive framework for interacting with ValtheraDB. It combines a flexible query language, a powerful permission management system, and a suite of tools to build secure and efficient data-driven applications.
_me, _now, _user) or custom variables in your queries for dynamic, context-aware operations.VQLConfig -control permissions, field selection, path visibility, and more.Here is an example of how to use the VQLProcessor to execute a query:
import VQLProcessor from "@wxn0brp/vql";
import { Valthera } from "@wxn0brp/db";
// Initialize database instances
const dbInstances = {
myDatabase: new Valthera("path/to/database"),
};
// Create a VQLProcessor instance
const processor = new VQLProcessor(dbInstances);
// Define a query (VQLR)
const query = {
db: "myDatabase",
d: {
find: {
collection: "users",
search: { $gt: { age: 18 } },
select: { name: 1, age: 1 },
},
},
};
// Or you can use a string query (VQLS):
const vqls = `
myDatabase users
s.$gt.age = 18
e.name = 1
e.age = 1
`;
// Execute the query
(async () => {
try {
const result = await processor.execute(query);
console.log("Query Result:", result);
} catch (error) {
console.error("Error executing query:", error);
}
})();
MIT License.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.