@wxn0brp/vql-translator
v0.0.2
Published
A simple tool that translates SQL queries to VQL (Valthera Query Language) format.
Readme
VQL Translator
A simple tool that translates SQL queries to VQL (Valthera Query Language) format.
Overview
This library converts standard SQL queries into VQL format, which can be used with the ValtheraDB system. It provides both object-based and string-based VQL representations.
Usage
import { SQL_TO_VQL } from "@wxn0brp/vql-translator";
const sql = "SELECT * FROM users WHERE id = 1";
const dbName = "db";
// Get VQL object
const vql = SQL_TO_VQL(sql, dbName);
console.log(vql);
// Get VQL string representation
const vqlString = SQL_TO_VQL(sql, dbName, true);
console.log(vqlString);Example
Input SQL:
SELECT * FROM users WHERE id = 1Output VQL object:
{
"db": "db",
"d": {
"find": {
"collection": "users",
"search": { "id": 1 }
}
}
}Features
- Converts SQL SELECT, UPDATE, INSERT, DELETE operations to VQL
- Supports both single and multiple record operations
- Provides both object and string representations of VQL
- Handles complex queries with search conditions, options, and selections
License
MIT License
Contributing
Contributions are welcome!
