@ronin/compiler 0.10.1-leo-ron-1083-experimental-210 → 0.10.2-leo-ron-1083-experimental-211
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -1
- package/dist/index.d.ts +12 -3
- package/package.json +1 -1
package/README.md
CHANGED
@@ -103,7 +103,24 @@ new Transaction(queries, {
|
|
103
103
|
// Instead of returning an array of parameters for every statement (which allows for
|
104
104
|
// preventing SQL injections), all parameters are inlined directly into the SQL strings.
|
105
105
|
// This option should only be used if the generated SQL will be manually verified.
|
106
|
-
inlineParams: true
|
106
|
+
inlineParams: true,
|
107
|
+
|
108
|
+
// By default, in the generated SQL statements, the compiler does not alias columns if
|
109
|
+
// multiple different tables with the same column names are being joined. Only the table
|
110
|
+
// names themselves are aliased.
|
111
|
+
//
|
112
|
+
// This ensures the cleanest possible SQL statements in conjunction with the default
|
113
|
+
// behavior of SQLite (and all other SQL databases), where the result of a statement is
|
114
|
+
// a list (array) of values, which are inherently not prone to conflicts.
|
115
|
+
//
|
116
|
+
// If the driver being used instead returns an object for every row, the driver must
|
117
|
+
// ensure the uniqueness of every key in that object, which means prefixing duplicated
|
118
|
+
// column names with the name of the respective table, if multiple tables are joined.
|
119
|
+
// Drivers that return objects for rows offer this behavior as an option that is
|
120
|
+
// usually called "expand columns". If the driver being used does not offer such an
|
121
|
+
// option, you can instead activate the option in the compiler, which results in longer
|
122
|
+
// SQL statements because any duplicated column name is aliased.
|
123
|
+
expandColumns: true
|
107
124
|
});
|
108
125
|
```
|
109
126
|
|
package/dist/index.d.ts
CHANGED
@@ -6005,13 +6005,22 @@ type AmountResult = {
|
|
6005
6005
|
};
|
6006
6006
|
type Result = SingleRecordResult | MultipleRecordResult | AmountResult;
|
6007
6007
|
|
6008
|
+
interface TransactionOptions {
|
6009
|
+
/** A list of models that already exist in the database. */
|
6010
|
+
models?: Array<PublicModel>;
|
6011
|
+
/**
|
6012
|
+
* Place statement parameters directly inside the statement strings instead of
|
6013
|
+
* separating them out into a dedicated `params` array.
|
6014
|
+
*/
|
6015
|
+
inlineParams?: boolean;
|
6016
|
+
/** Alias column names that are duplicated when joining multiple tables. */
|
6017
|
+
expandColumns?: boolean;
|
6018
|
+
}
|
6008
6019
|
declare class Transaction {
|
6009
6020
|
statements: Array<Statement>;
|
6010
6021
|
models: Array<Model>;
|
6011
6022
|
private queries;
|
6012
|
-
constructor(queries: Array<Query>, options?:
|
6013
|
-
models?: Array<PublicModel>;
|
6014
|
-
});
|
6023
|
+
constructor(queries: Array<Query>, options?: TransactionOptions);
|
6015
6024
|
/**
|
6016
6025
|
* Composes SQL statements for the provided RONIN queries.
|
6017
6026
|
*
|
package/package.json
CHANGED