@ronin/compiler 0.6.1 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +4 -4
- package/dist/index.d.ts +332 -111
- package/dist/index.js +341 -350
- package/package.json +1 -1
package/README.md
CHANGED
@@ -43,7 +43,7 @@ import {
|
|
43
43
|
compileQueries,
|
44
44
|
|
45
45
|
type Query,
|
46
|
-
type
|
46
|
+
type Model,
|
47
47
|
type Statement
|
48
48
|
} from '@ronin/compiler';
|
49
49
|
|
@@ -53,11 +53,11 @@ const queries: Array<Query> = [{
|
|
53
53
|
}
|
54
54
|
}];
|
55
55
|
|
56
|
-
const
|
56
|
+
const models: Array<Model> = [{
|
57
57
|
slug: 'account'
|
58
58
|
}];
|
59
59
|
|
60
|
-
const statements: Array<
|
60
|
+
const statements: Array<Statement> = compileQueries(queries, models);
|
61
61
|
// [{
|
62
62
|
// statement: 'SELECT * FROM "accounts"',
|
63
63
|
// params: [],
|
@@ -70,7 +70,7 @@ const statements: Array<Statements> = compileQueries(queries, schemas);
|
|
70
70
|
To fine-tune the behavior of the compiler, you can pass the following options:
|
71
71
|
|
72
72
|
```typescript
|
73
|
-
compileQueries(queries,
|
73
|
+
compileQueries(queries, models, {
|
74
74
|
// Instead of returning an array of parameters for every statement (which allows for
|
75
75
|
// preventing SQL injections), all parameters are inlined directly into the SQL strings.
|
76
76
|
// This option should only be used if the generated SQL will be manually verified.
|