https://github.com/hangxingliu/node-sqlite-ddl-parser
⛓ A SQLite DDL parser module
https://github.com/hangxingliu/node-sqlite-ddl-parser
ddl parser sqlite3
Last synced: 2 months ago
JSON representation
⛓ A SQLite DDL parser module
- Host: GitHub
- URL: https://github.com/hangxingliu/node-sqlite-ddl-parser
- Owner: hangxingliu
- License: gpl-3.0
- Created: 2018-12-15T10:17:58.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-15T10:27:54.000Z (almost 7 years ago)
- Last Synced: 2025-08-04T06:51:29.308Z (2 months ago)
- Topics: ddl, parser, sqlite3
- Language: JavaScript
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SQlite DDL Parser
[![NPM version][npm-image]][npm-url]
[![Build status][travis-image]][travis-url][npm-image]: https://img.shields.io/npm/v/sqlite-ddl-parser.svg
[npm-url]: https://npmjs.org/package/sqlite-ddl-parser
[travis-image]: https://travis-ci.org/hangxingliu/node-sqlite-ddl-parser.svg?branch=master
[travis-url]: https://travis-ci.org/hangxingliu/node-sqlite-ddl-parserA SQLite DDL([Data definition language](https://en.wikipedia.org/wiki/Data_definition_language)) parser module.
This module is built on [codeschool/sqlite-parser](https://github.com/codeschool/sqlite-parser)
## Install
``` bash
npm install sqlite-ddl-parser
```## Example
``` javascript
const fs = require('fs');
const SQLiteDDLParser = require('sqlite-ddl-parser');console.log(SQLiteDDLParser.parse(fs.readFileSync('./test/sql/contacts.sql')));
/*
{
"tables": [{
"name": "contacts",
"columns": [{
"name": "contact_id",
"type": "integer",
"notNull": false,
"unique": false
},{
"name": "first_name",
"type": "text",
"notNull": true,
"unique": false
},{
"name": "last_name",
"type": "text",
"notNull": true,
"unique": false
},{
"name": "email",
"type": "text",
"notNull": true,
"unique": true
},{
"name": "phone",
"type": "text",
"notNull": true,
"unique": true
}],
"primaryKeys": [
"contact_id"
]
}]
}
*/```
## Author
[Liu Yue](https://github.com/hangxingliu)
## License
[GPL-3.0](LICENSE)