@ronin/compiler 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -39,7 +39,7 @@ You will just need to make sure that, once you [create a pull request](https://d
39
39
  The programmatic API of the RONIN compiler looks like this:
40
40
 
41
41
  ```typescript
42
- import { compileQueryInput } from '@ronin/compiler';
42
+ import { compileQuery } from '@ronin/compiler';
43
43
 
44
44
  const query = {
45
45
  get: {
@@ -53,12 +53,27 @@ const schemas = [
53
53
  },
54
54
  ];
55
55
 
56
- const { writeStatements, readStatement } = compileQueryInput(query, schemas);
56
+ const { writeStatements, readStatement } = compileQuery(query, schemas);
57
57
 
58
58
  console.log(readStatement);
59
59
  // SELECT * FROM "accounts" ORDER BY "ronin.createdAt" DESC LIMIT 101
60
60
  ```
61
61
 
62
+ #### Options
63
+
64
+ To fine-tune the behavior of the compiler, you can pass the following options:
65
+
66
+ ```typescript
67
+ compileQuery(query, schemas, {
68
+ // Instead of returning an array of values for every statement (which allows for
69
+ // preventing SQL injections), all values are inlined directly into the SQL strings.
70
+ // This option should only be used if the generated SQL will be manually verified.
71
+ inlineValues: true
72
+ });
73
+ ```
74
+
75
+ #### Transpilation
76
+
62
77
  In order to be compatible with a wide range of projects, the source code of the `compiler` repo needs to be compiled (transpiled) whenever you make changes to it. To automate this, you can keep this command running in your terminal:
63
78
 
64
79
  ```bash