Skip to content

Commit 2299738

Browse files
authored
Merge pull request #7 from lastlink/f/lastlink
simple example and pull request template
2 parents 12d5930 + 8a18b5b commit 2299738

4 files changed

Lines changed: 39 additions & 6 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Fixes # .
2+
3+
Changes proposed in this pull request:
4+
-
5+
-
6+
-

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "sqlsimpleparser",
2+
"name": "@funktechno/sqlsimpleparser",
33
"version": "0.0.2",
44
"description": "",
55
"main": "index.js",

tests/examples_models.spec.ts

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe("Example Sql Parsing", () => {
6565
await runSample();
6666
expect(1).toBeTruthy();
6767
});
68-
it("Run Parser postgres Ex", async () => {
68+
it("Run Parser sqlserver Ex", async () => {
6969
const filePath = "examples/adventureworks_mssql.sql";
7070
async function runSample() {
7171
// load sql
@@ -86,4 +86,31 @@ describe("Example Sql Parsing", () => {
8686
await runSample();
8787
expect(1).toBeTruthy();
8888
});
89+
90+
it("Run Parser postgres simple", async () => {
91+
async function runSample() {
92+
// load sql
93+
var sql = `CREATE TABLE "humanresources_department" (
94+
"departmentid" serial NOT NULL,
95+
"name" Name NOT NULL,
96+
"groupname" Name NOT NULL,
97+
"modifieddate" timestamp NOT NULL,
98+
PRIMARY KEY("departmentid")
99+
);`
100+
console.log(sql);
101+
102+
// run parser
103+
const parser = new SqlSimpleParser('sqlserver')
104+
105+
// get models
106+
const models = parser
107+
.feed(sql)
108+
.ToModel();
109+
110+
// write to json file
111+
await fs.writeFileSync("output-pg_simple.json", JSON.stringify(models, null, '\t'));
112+
}
113+
await runSample();
114+
expect(1).toBeTruthy();
115+
});
89116
});

0 commit comments

Comments
 (0)