Skip to content

Commit 913d92c

Browse files
committed
docs: Avoid using pronouns where possible
1 parent 0188c84 commit 913d92c

File tree

4 files changed

+30
-28
lines changed

4 files changed

+30
-28
lines changed

README.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ when it is used as a data-object value or `?` placeholder replacement.
285285

286286
| Param | Type | Description |
287287
|:--- |:--- |:--- |
288-
| sql | <code>string</code> | SQL that you do not want to be escaped. |
288+
| sql | <code>string</code> | SQL that should not be escaped. |
289289

290290
**Returns**: <code>Object</code> - An object that is turned into the provided `sql` string when `mysql` attempts to escape it.
291291
**See**: [(mysql) Escaping query values](https://github.com/mysqljs/mysql#escaping-query-values)
@@ -336,7 +336,7 @@ Defines a table to be created or updated in the database.
336336
| schema | <code>Object</code> | An object that defines the table's schema. See the [Defining Table Schemas](#defining-table-schemas) section. |
337337
| [migrationStrategy] | <code>string</code> | One of `safe`, `alter`, or `drop`. This will override the `migrationStrategy` value from the [`config`](#module_mysql-plus..createPool) (but is still subject to the same restrictions in production environments). |
338338

339-
**Returns**: <code>[MySQLTable](#MySQLTable)</code> - A `MySQLTable` instance that lets you perform queries on the table.
339+
**Returns**: <code>[MySQLTable](#MySQLTable)</code> - A `MySQLTable` instance that has methods for performing queries on the table.
340340
**See**: [Defining Table Schemas](#defining-table-schemas)
341341

342342
**Example**:
@@ -830,7 +830,7 @@ fails because of a unique key constraint).
830830

831831
| Param | Type | Description |
832832
|:--- |:--- |:--- |
833-
| data | <code>Object</code> | An object mapping column names to data values to insert. The values are escaped by default. If you don't want a value to be escaped, create a "raw" value (see the last example below). |
833+
| data | <code>Object</code> | An object mapping column names to data values to insert. |
834834
| keyColumns | <code>Array.&lt;string&gt;</code> | The names of columns in the `data` object. If there is already a row in the table with the same values for these columns as the values being inserted, the data will not be inserted. |
835835
| [cb] | <code>[queryCallback](#module_mysql-plus..queryCallback)</code> | A callback that gets called with the results of the query. |
836836

@@ -886,7 +886,7 @@ optional but at least one of them must be specified.
886886

887887
| Param | Type | Description |
888888
|:--- |:--- |:--- |
889-
| [data] | <code>Object</code> | An object of (column name)-(data value) pairs that define the new column values. This object will be escaped by `mysql.escape()` so if you want to use more sophisticated SQL (such as a MySQL function) to update a column's value, you'll need to use the `sqlString` argument instead. |
889+
| [data] | <code>Object</code> | An object of (column name)-(data value) pairs that define the new column values. |
890890
| [sqlString] | <code>string</code> | SQL to be appended to the query after the `SET data` clause or immediately after `SET ` if `data` is omitted. |
891891
| [values] | <code>Array</code> | Values to replace the placeholders in `sqlString` (and/or `data`). |
892892
| [cb] | <code>[queryCallback](#module_mysql-plus..queryCallback)</code> | A callback that gets called with the results of the query. |
@@ -917,6 +917,9 @@ userTable.update('`points` = `points` + ? WHERE `winner` = ?', [10, 1]);
917917
```js
918918
userTable.update({points: 1000});
919919
// UPDATE `user` SET `points` = 1000;
920+
921+
userTable.update({points: mysql.raw('`points` + 10')});
922+
// UPDATE `user` SET `points` = `points` + 10;
920923
```
921924

922925

@@ -1011,7 +1014,7 @@ The possible migration strategies are as follows:
10111014
+ `alter` - default in a development environment
10121015
+ `drop`
10131016

1014-
In addition to being the default in a production environment, the `safe` strategy is the only allowed strategy in production. This means that if `alter` or `drop` are used anywhere to configure your connections or tables, they will be ignored and `safe` will be used instead. However, if you really want to use `alter` in production, you may set the `allowAlterInProduction` option to `true` in your [Pool configuration](#mysql-pluscreatepoolconfig--poolplus).
1017+
In addition to being the default in a production environment, the `safe` strategy is the only allowed strategy in production. This means that if `alter` or `drop` are used anywhere to configure connections or tables, they will be ignored and `safe` will be used instead. However, it is possible to override this behavior to allow the `alter` strategy in production by setting the `allowAlterInProduction` option to `true` in the [Pool configuration](#mysql-pluscreatepoolconfig--poolplus).
10151018

10161019
### safe
10171020

@@ -1021,9 +1024,9 @@ Only allows newly-defined tables to be created. Existing tables are never change
10211024

10221025
Specifies that newly-defined tables will be created, existing tables that are no longer defined will be dropped, and existing tables that have a different definition from what is found in the database will be migrated with minimal data-loss.
10231026

1024-
**To rename table columns**, you must specify the column's old name in the [column definition](#columndefinition) with the `.oldName('name')` method. If you don't, the column will be dropped and you will lose all of the data that was in that column.
1027+
**To rename table columns**, the column's old name must be specified in the [column definition](#columndefinition) with the `.oldName('name')` method. If it is not, the column will be dropped and all of the data that was in that column will be lost.
10251028

1026-
**Note:** It is up to you to understand how changes to an existing table might affect the data. For example, changing a DOUBLE column to a FLOAT will cause the precision of the value to be reduced so you may lose some significant digits (i.e. `1.123456789` would be reduced to `1.12346`). Furthermore, some changes to tables cannot be done and will cause an error. An example of this would be adding a column with the `NOT NULL` attribute to a non-empty table without specifying a default value.
1029+
**Note:** It is up to you to understand how changes to an existing table might affect the data. For example, changing a DOUBLE column to a FLOAT will cause the precision of the value to be reduced so some significant digits may be lost (i.e. `1.123456789` would be reduced to `1.12346`). Furthermore, some changes to tables cannot be done and will cause an error. An example of this would be adding a column with the `NOT NULL` attribute to a non-empty table without specifying a default value.
10271030

10281031
### drop
10291032

@@ -1054,7 +1057,7 @@ Columns are defined using the `column` property which is an object where the key
10541057
}
10551058
```
10561059

1057-
See the [Column Types](#column-types) section for all possible column types and attributes that you can define.
1060+
See the [Column Types](#column-types) section for all possible column types and attributes that can be defined.
10581061

10591062
### Keys
10601063

@@ -1065,7 +1068,7 @@ The following properties can be used to define different types of keys:
10651068
+ [`indexes`](#indexes--arraystringstring)
10661069
+ [`spatialIndexes`](#spatialindexes--string)
10671070

1068-
Note that [column definitions](#columndefinition) allow you to define these keys directly on the column. If you use that method of defining a key for a column, you should not define the key again using one of these properties.
1071+
Note that [column definitions](#columndefinition) allow these keys to be defined directly on the column. If that method of defining a key for a column is used, the key should not be defined again using one of these properties (otherwise it will be duplicated).
10691072

10701073
#### `primaryKey` : `string|string[]`
10711074

@@ -1139,7 +1142,7 @@ If an object, it should have the following properties:
11391142
+ `onDelete` (optional) - One of: `RESTRICT`, `CASCADE`, `SET NULL`, `NO ACTION`, `SET DEFAULT`.
11401143
+ `onUpdate` (optional) - Same as `onDelete`.
11411144

1142-
Alternatively, you can use a shorthand string that has the following form:
1145+
Alternatively, a shorthand string that has the following form may be used:
11431146

11441147
```js
11451148
'<table>.<column> [reference_option]' // `[reference_option]` is optional
@@ -1221,7 +1224,7 @@ These schema properties configure table-level options. The options currently sup
12211224
}
12221225
```
12231226

1224-
**Note:** After explicitly defining a table option in your schema, if you remove it from your schema and resync your table definitions, the table option will not change in the database. If you want to go back to the default value for the table option, you'll need to explicitly define it on your schema and resync the table (or manually change it on the command line), and then you may remove it from your schema.
1227+
**Note:** After explicitly defining a table option in a schema, if you remove it from the schema and resync your table definitions, the table option will not change in the database. To go back to the default value for the table option, you'll need to explicitly define it on the schema and resync the table (or manually change it on the command line), and then you may remove it from the schema.
12251228

12261229
## Column Types
12271230

@@ -1358,7 +1361,7 @@ Compatible types:
13581361

13591362
+ `timestamp`
13601363

1361-
There aren't any extra methods on this type, but there are some things you should be aware of with `timestamp` columns:
1364+
There aren't any extra methods on this type, but there are some things to be aware of with `timestamp` columns:
13621365

13631366
##### NULL Timestamps
13641367

@@ -1378,7 +1381,7 @@ would define a column with this SQL:
13781381

13791382
##### Timestamps' DEFAULT value
13801383

1381-
If you define a timestamp column and use the `notNull()` method, the column's `DEFAULT` value will be set to `CURRENT_TIMESTAMP`. So the following:
1384+
If a timestamp column is defined with the `notNull()` method, the column's `DEFAULT` value will be set to `CURRENT_TIMESTAMP`. So the following:
13821385

13831386
```js
13841387
{

jsdoc2md/README.hbs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ The possible migration strategies are as follows:
113113
+ `alter` - default in a development environment
114114
+ `drop`
115115

116-
In addition to being the default in a production environment, the `safe` strategy is the only allowed strategy in production. This means that if `alter` or `drop` are used anywhere to configure your connections or tables, they will be ignored and `safe` will be used instead. However, if you really want to use `alter` in production, you may set the `allowAlterInProduction` option to `true` in your [Pool configuration](#mysql-pluscreatepoolconfig--poolplus).
116+
In addition to being the default in a production environment, the `safe` strategy is the only allowed strategy in production. This means that if `alter` or `drop` are used anywhere to configure connections or tables, they will be ignored and `safe` will be used instead. However, it is possible to override this behavior to allow the `alter` strategy in production by setting the `allowAlterInProduction` option to `true` in the [Pool configuration](#mysql-pluscreatepoolconfig--poolplus).
117117

118118
### safe
119119

@@ -123,9 +123,9 @@ Only allows newly-defined tables to be created. Existing tables are never change
123123

124124
Specifies that newly-defined tables will be created, existing tables that are no longer defined will be dropped, and existing tables that have a different definition from what is found in the database will be migrated with minimal data-loss.
125125

126-
**To rename table columns**, you must specify the column's old name in the [column definition](#columndefinition) with the `.oldName('name')` method. If you don't, the column will be dropped and you will lose all of the data that was in that column.
126+
**To rename table columns**, the column's old name must be specified in the [column definition](#columndefinition) with the `.oldName('name')` method. If it is not, the column will be dropped and all of the data that was in that column will be lost.
127127

128-
**Note:** It is up to you to understand how changes to an existing table might affect the data. For example, changing a DOUBLE column to a FLOAT will cause the precision of the value to be reduced so you may lose some significant digits (i.e. `1.123456789` would be reduced to `1.12346`). Furthermore, some changes to tables cannot be done and will cause an error. An example of this would be adding a column with the `NOT NULL` attribute to a non-empty table without specifying a default value.
128+
**Note:** It is up to you to understand how changes to an existing table might affect the data. For example, changing a DOUBLE column to a FLOAT will cause the precision of the value to be reduced so some significant digits may be lost (i.e. `1.123456789` would be reduced to `1.12346`). Furthermore, some changes to tables cannot be done and will cause an error. An example of this would be adding a column with the `NOT NULL` attribute to a non-empty table without specifying a default value.
129129

130130
### drop
131131

@@ -156,7 +156,7 @@ Columns are defined using the `column` property which is an object where the key
156156
}
157157
```
158158

159-
See the [Column Types](#column-types) section for all possible column types and attributes that you can define.
159+
See the [Column Types](#column-types) section for all possible column types and attributes that can be defined.
160160

161161
### Keys
162162

@@ -167,7 +167,7 @@ The following properties can be used to define different types of keys:
167167
+ [`indexes`](#indexes--arraystringstring)
168168
+ [`spatialIndexes`](#spatialindexes--string)
169169

170-
Note that [column definitions](#columndefinition) allow you to define these keys directly on the column. If you use that method of defining a key for a column, you should not define the key again using one of these properties.
170+
Note that [column definitions](#columndefinition) allow these keys to be defined directly on the column. If that method of defining a key for a column is used, the key should not be defined again using one of these properties (otherwise it will be duplicated).
171171

172172
#### `primaryKey` : `string|string[]`
173173

@@ -241,7 +241,7 @@ If an object, it should have the following properties:
241241
+ `onDelete` (optional) - One of: `RESTRICT`, `CASCADE`, `SET NULL`, `NO ACTION`, `SET DEFAULT`.
242242
+ `onUpdate` (optional) - Same as `onDelete`.
243243

244-
Alternatively, you can use a shorthand string that has the following form:
244+
Alternatively, a shorthand string that has the following form may be used:
245245

246246
```js
247247
'<table>.<column> [reference_option]' // `[reference_option]` is optional
@@ -323,7 +323,7 @@ These schema properties configure table-level options. The options currently sup
323323
}
324324
```
325325

326-
**Note:** After explicitly defining a table option in your schema, if you remove it from your schema and resync your table definitions, the table option will not change in the database. If you want to go back to the default value for the table option, you'll need to explicitly define it on your schema and resync the table (or manually change it on the command line), and then you may remove it from your schema.
326+
**Note:** After explicitly defining a table option in a schema, if you remove it from the schema and resync your table definitions, the table option will not change in the database. To go back to the default value for the table option, you'll need to explicitly define it on the schema and resync the table (or manually change it on the command line), and then you may remove it from the schema.
327327

328328
## Column Types
329329

@@ -460,7 +460,7 @@ Compatible types:
460460

461461
+ `timestamp`
462462

463-
There aren't any extra methods on this type, but there are some things you should be aware of with `timestamp` columns:
463+
There aren't any extra methods on this type, but there are some things to be aware of with `timestamp` columns:
464464

465465
##### NULL Timestamps
466466

@@ -480,7 +480,7 @@ would define a column with this SQL:
480480

481481
##### Timestamps' DEFAULT value
482482

483-
If you define a timestamp column and use the `notNull()` method, the column's `DEFAULT` value will be set to `CURRENT_TIMESTAMP`. So the following:
483+
If a timestamp column is defined with the `notNull()` method, the column's `DEFAULT` value will be set to `CURRENT_TIMESTAMP`. So the following:
484484

485485
```js
486486
{

lib/MySQLTable.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,6 @@ class MySQLTable {
262262
* fails because of a unique key constraint).
263263
*
264264
* @param {Object} data - An object mapping column names to data values to insert.
265-
* The values are escaped by default. If you don't want a value to be escaped,
266-
* create a "raw" value (see the last example below).
267265
* @param {string[]} keyColumns - The names of columns in the `data` object.
268266
* If there is already a row in the table with the same values for these
269267
* columns as the values being inserted, the data will not be inserted.
@@ -333,8 +331,6 @@ class MySQLTable {
333331
* optional but at least one of them must be specified.
334332
*
335333
* @param {Object} [data] - An object of (column name)-(data value) pairs that define the new column values.
336-
* This object will be escaped by `mysql.escape()` so if you want to use more sophisticated SQL (such as
337-
* a MySQL function) to update a column's value, you'll need to use the `sqlString` argument instead.
338334
* @param {string} [sqlString] - SQL to be appended to the query after the `SET data` clause
339335
* or immediately after `SET ` if `data` is omitted.
340336
* @param {Array} [values] - Values to replace the placeholders in `sqlString` (and/or `data`).
@@ -360,6 +356,9 @@ class MySQLTable {
360356
* @example <caption>With only the `data` argument (updates all rows)</caption>
361357
* userTable.update({points: 1000});
362358
* // UPDATE `user` SET `points` = 1000;
359+
*
360+
* userTable.update({points: mysql.raw('`points` + 10')});
361+
* // UPDATE `user` SET `points` = `points` + 10;
363362
*/
364363
update(data, sqlString, values, cb) {
365364
if (typeof data === 'string') {

lib/PoolPlus.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class PoolPlus extends Pool {
6767
* when it is used as a data-object value or `?` placeholder replacement.
6868
* (The same as [`mysql.raw()`](https://github.com/mysqljs/mysql#escaping-query-values).)
6969
*
70-
* @param {string} sql - SQL that you do not want to be escaped.
70+
* @param {string} sql - SQL that should not be escaped.
7171
* @return {Object} An object that is turned into the provided `sql` string when `mysql` attempts to escape it.
7272
* @see {@link https://github.com/mysqljs/mysql#escaping-query-values|(mysql) Escaping query values}
7373
*
@@ -113,7 +113,7 @@ class PoolPlus extends Pool {
113113
* @param {string} [migrationStrategy] - One of `safe`, `alter`, or `drop`. This will override
114114
* the `migrationStrategy` value from the {@link module:mysql-plus~createPool|`config`}
115115
* (but is still subject to the same restrictions in production environments).
116-
* @returns {MySQLTable} A `MySQLTable` instance that lets you perform queries on the table.
116+
* @returns {MySQLTable} A `MySQLTable` instance that has methods for performing queries on the table.
117117
* @see [Defining Table Schemas](#defining-table-schemas)
118118
*
119119
* @example

0 commit comments

Comments
 (0)