@ronin/compiler 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +7 -7
- package/dist/index.d.ts +1199 -148
- package/dist/index.js +422 -403
- 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,11 +70,11 @@ 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,
|
74
|
-
// Instead of returning an array of
|
75
|
-
// preventing SQL injections), all
|
73
|
+
compileQueries(queries, models, {
|
74
|
+
// Instead of returning an array of parameters for every statement (which allows for
|
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.
|
77
|
-
|
77
|
+
inlineParams: true
|
78
78
|
});
|
79
79
|
```
|
80
80
|
|