Licence
ISC
Version
0.3.0
Deps
0
Size
4 kB
Vulns
0
Weekly
0
Argia easy SQL converter
Alternative query syntax that converts to raw SQL
Usage
const argia = require("argia")
const sql = argia("users(id,title,age)") // SELECT id, title, age FROM users
const rows = await adapter.query(sql)
Examples
Select
| Argia SQL | SQL |
|---|---|
| users(*) | SELECT * FROM users |
| users(id,title,age) | SELECT id, title, age FROM users |
| users(id,title,age){3} | SELECT id, title, age FROM users LIMIT 3 |
| users(id,title,age){3,1}</td> <td>SELECT id, title, age FROM users ORDER BY title LIMIT 3 OFFSET 1</td> </tr> <tr> <td>users(id,title,age){3,1}<-age></td> <td>SELECT id, title, age FROM users ORDER BY age DESC LIMIT 3 OFFSET 1</td> </tr> </tbody></table> <h5 id="user-content-insert" data-level="3"><a href="#user-content-insert">Insert</a></h5> <table> <thead> <tr> <th>Argia SQL</th> <th>SQL</th> </tr> </thead> <tbody><tr> <td>('John Doe'|33)>users(name, age)</td> <td>INSERT INTO users (name, age) VALUES ('John Doe', 33)</td> </tr> </tbody></table> |