Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robinblomberg/sqlite-ast
Abstract Syntax Tree (AST) classes for representing SQLite statements.
https://github.com/robinblomberg/sqlite-ast
ast sqlite
Last synced: 1 day ago
JSON representation
Abstract Syntax Tree (AST) classes for representing SQLite statements.
- Host: GitHub
- URL: https://github.com/robinblomberg/sqlite-ast
- Owner: RobinBlomberg
- Created: 2020-12-19T07:34:57.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-01-02T09:40:52.000Z (about 1 year ago)
- Last Synced: 2024-04-15T00:17:20.685Z (9 months ago)
- Topics: ast, sqlite
- Language: JavaScript
- Homepage:
- Size: 123 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SQLite AST
A library for creating abstract syntax trees for SQLite. Useful in conjunction with
[@robinblomberg/sqlite-compiler](https://github.com/RobinBlomberg/sqlite-compiler) to
programmatically create and manipulate SQLite. It is well-tested and covers the entire SQLite
specification (at the time of creation).## Installation
```sh
npm install @robinblomberg/sqlite-ast
```## Usage
```js
import { Nodes } from '@robinblomberg/sqlite-ast';// 'SELECT result-column FROM ((SELECT 1), table-name AS table-alias)'
const ast = Nodes.SelectStmt(
null,
[
Nodes._SelectClause(
null,
[Nodes.ResultColumn(Nodes._Identifier('result-column'))],
[
Nodes._TableQueryClause([
Nodes._TableSelectClause(
Nodes.SelectStmt(
null,
[
Nodes._SelectClause(
null,
[Nodes.ResultColumn(Nodes._NumericLiteral(1))],
[],
null,
null,
[],
),
],
null,
),
null,
),
Nodes.QualifiedTableName(
Nodes._Identifier('table-name'),
Nodes._Identifier('table-alias'),
null,
),
]),
],
null,
null,
[],
),
],
null,
);
```