Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Update grammar #544

Merged
merged 9 commits into from
Mar 7, 2019
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 33 additions & 34 deletions src/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ export interface RunUpdateCallback {
* but does not allow writes. Snapshot read-only transactions can be configured
* to read at timestamps in the past.
*
* When finished with the Snapshot, you should call {@link Snapshot#end} to
* release the underlying {@link Session}. Failure to do can result in a
* When finished with the Snapshot, call {@link Snapshot#end} to
* release the underlying {@link Session}. Failure to do so can result in a
* Session leak.
*
* **This object is created and returned from {@link Database#getSnapshot}.**
Expand All @@ -141,7 +141,7 @@ export interface RunUpdateCallback {
* // Error handling omitted.
* }
*
* // should be called when finished with the snapshot
* // It should be called when the snapshot finishes.
* transaction.end();
* });
*/
Expand All @@ -163,22 +163,22 @@ export class Snapshot extends EventEmitter {
* @type {?(string|Buffer)}
*/
/**
* Whether or not the transaction has been ended. If true, no further requests
* should be made and the transaction should be discarded.
* Whether or not the transaction has ended. If true, no further requests
* are made and the transaction is discarded.
romlogic marked this conversation as resolved.
Show resolved Hide resolved
*
* @name Snapshot#ended
* @type {boolean}
*/
/**
* The raw transaction response object. Will be populated after
* {@link Snapshot#begin} has been called.
* The raw transaction response object. It is populated after
* {@link Snapshot#begin} is called.
*
* @name Snapshot#metadata
* @type {?TransactionResponse}
*/
/**
* **Snapshot only**
* The timestamp at which all reads will be performed.
* The timestamp at which all reads are performed.
*
* @name Snapshot#readTimestamp
* @type {?external:PreciseDate}
Expand Down Expand Up @@ -227,7 +227,7 @@ export class Snapshot extends EventEmitter {
* @param {TransactionResponse} apiResponse The raw transaction object.
*/
/**
* Begin a new transaction. Typically you shouldn't need to call this unless
* Begin a new transaction. Typically, you need not call this unless
* manually creating transactions via {@link Session} objects.
*
* @see [BeginTransaction API Documentation](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.v1#google.spanner.v1.Spanner.BeginTransaction)
Expand All @@ -242,7 +242,7 @@ export class Snapshot extends EventEmitter {
* }
* });
*
* @example <caption>If the callback is omitted, we'll return a Promise
* @example <caption>If the callback is omitted, the function returns a Promise
* </caption>
* transaction.begin()
* .then(function(data) {
Expand Down Expand Up @@ -310,7 +310,7 @@ export class Snapshot extends EventEmitter {
* @property {string[]} [keys] The primary keys of the rows in this table to be
* yielded. If using a composite key, provide an array within this array.
* See the example below.
* @property {KeyRange[]} [ranges] An alternative to the keys property, this can
* @property {KeyRange[]} [ranges] An alternative to the keys property; this can
* be used to define a range of keys to be yielded.
* @property {boolean} [json=false] Receive the rows as serialized objects. This
* is the equivalent of calling `toJSON()` on each row.
Expand Down Expand Up @@ -393,7 +393,7 @@ export class Snapshot extends EventEmitter {
* });
*
* @example <caption>Alternatively, set `query.json` to `true`, and this step
* will be performed automatically.</caption>
romlogic marked this conversation as resolved.
Show resolved Hide resolved
* will perform automatically.</caption>
* transaction.createReadStream('Singers', {
* keys: ['1'],
* columns: ['SingerId', 'name'],
Expand Down Expand Up @@ -490,9 +490,9 @@ export class Snapshot extends EventEmitter {
*
* transaction.runUpdate(query, err => {
* if (err) {
* // In the event of an error here there would be nothing to rollback,
* // In the event of an error, there would be nothing to rollback,
* so
* // instead of continuing, we might want to just discard the
* // instead of continuing, discard the
* transaction. transaction.end(); return;
* }
*
Expand All @@ -518,7 +518,7 @@ export class Snapshot extends EventEmitter {
* object has a `name` and `value` property. To get a serialized object,
* call `toJSON()`. Optionally, provide an options object to `toJSON()`
* specifying `wrapNumbers: true` to protect large integer values outside
* of the range of JavaScript Number. If set, FLOAT64 values will be returned
* of the range of JavaScript Number. If set, FLOAT64 values are returned
* as {@link Spanner.Float} objects and INT64 values as {@link
* Spanner.Int}.
*/
Expand All @@ -529,7 +529,7 @@ export class Snapshot extends EventEmitter {
* object has a `name` and `value` property. To get a serialized object,
* call `toJSON()`. Optionally, provide an options object to `toJSON()`
* specifying `wrapNumbers: true` to protect large integer values outside
* of the range of JavaScript Number. If set, FLOAT64 values will be returned
* of the range of JavaScript Number. If set, FLOAT64 values are returned
* as {@link Spanner.Float} objects and INT64 values as {@link
* Spanner.Int}.
*/
Expand Down Expand Up @@ -605,7 +605,7 @@ export class Snapshot extends EventEmitter {
* });
*
* @example <caption>Alternatively, set `query.json` to `true`, and this step
* will be performed automatically.</caption>
romlogic marked this conversation as resolved.
Show resolved Hide resolved
* will perform automatically.</caption>
* query.json = true;
*
* transaction.read('Singers', query, function(err, rows) {
Expand Down Expand Up @@ -651,9 +651,8 @@ export class Snapshot extends EventEmitter {
* **Performance Considerations:**
*
* This method wraps the streaming method,
* {@link Snapshot#run} for your convenience. All rows will
* be stored in memory before being released to your callback. If you intend
* on receiving a lot of results from your query, consider using the streaming
* {@link Snapshot#run} for your convenience. All rows are stored in memory before being released to your callback.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely running over that 80 char limit here. Does npm run fix correct this?

* If you intend on receiving a lot of results from your query, consider using the streaming
* method, so you can free each result from memory after consuming it.
*
* Wrapper around {@link v1.SpannerClient#executeStreamingSql}.
Expand Down Expand Up @@ -911,7 +910,7 @@ export class Snapshot extends EventEmitter {
codec.convertMsToProtoTimestamp(options.exactStaleness as number);
}

// if we didn't detect a convenience format, we'll just assume that maybe
// If we didn't detect a convenience format, we'll just assume that
// they passed in a protobuf timestamp.
if (is.empty(readOnly)) {
Object.assign(readOnly, options);
Expand All @@ -927,7 +926,7 @@ export class Snapshot extends EventEmitter {
* @private
* @static
*
* @param {ExecuteSqlRequest} request The sql request.
* @param {ExecuteSqlRequest} request The SQL request.
* @returns {object}
*/
static encodeParams(request: ExecuteSqlRequest) {
Expand Down Expand Up @@ -964,15 +963,15 @@ export class Snapshot extends EventEmitter {

/*! Developer Documentation
*
* All async methods (except for streams) will return a Promise in the event
* All async methods (except for streams) return a Promise in the event
* that a callback is omitted.
*/
promisifyAll(Snapshot, {
exclude: ['end'],
});

/**
* Dml class should never be used directly. Instead it should be extended upon
* Never use DML class directly. Instead, it should be extended upon
* if a class requires DML capabilities.
*
* @private
Expand All @@ -993,7 +992,7 @@ export class Dml extends Snapshot {
* @param {number} rowCount Affected row count.
*/
/**
* Execute a DML statements and get the affected row count.
* Execute a DML statement and get the affected row count.
*
* @private
*
Expand Down Expand Up @@ -1032,7 +1031,7 @@ export class Dml extends Snapshot {

/*! Developer Documentation
*
* All async methods (except for streams) will return a Promise in the event
* All async methods (except for streams) return a Promise in the event
* that a callback is omitted.
*/
promisifyAll(Dml);
Expand All @@ -1046,14 +1045,14 @@ promisifyAll(Dml);
* Calling either {@link Transaction#commit} or {@link Transaction#rollback}
* signals that the transaction is finished and no further requests will be
* made. If for some reason you decide not to call one of the aformentioned
* methods, you should call {@link Transaction#end} to release the underlying
* methods, call {@link Transaction#end} to release the underlying
* {@link Session}.
*
* Running a transaction via {@link Database#runTransaction} or
* {@link Database#runTransactionAsync} will automatically re-run the
* {@link Database#runTransactionAsync} automatically re-runs the
* transaction on `ABORTED` errors.
*
* {@link Database#getTransaction} will return a plain {@link Transaction}
* {@link Database#getTransaction} returns a plain {@link Transaction}
* object, requiring the user to retry manually.
*
* @class
Expand Down Expand Up @@ -1098,7 +1097,7 @@ export class Transaction extends Dml {
* @type {?google.protobuf.Timestamp}
*/
/**
* Execute a DML statements and get the affected row count.
* Execute a DML statement and get the affected row count.
*
* @name Transaction#runUpdate
*
Expand Down Expand Up @@ -1533,7 +1532,7 @@ export class Transaction extends Dml {

/*! Developer Documentation
*
* All async methods (except for streams) will return a Promise in the event
* All async methods (except for streams) return a Promise in the event
* that a callback is omitted.
*/
promisifyAll(Transaction, {
Expand All @@ -1552,7 +1551,7 @@ promisifyAll(Transaction, {
* statement over each partition in parallel using separate, internal
* transactions that commit independently.
*
* Chances are you'll never need to create a partitioned dml transaction
* Chances are, you'll never need to create a partitioned DML transaction
* directly, instead you'll want to use {@link Database#runPartitionedUpdate}.
*
* @class
Expand All @@ -1569,7 +1568,7 @@ export class PartitionedDml extends Dml {
runUpdate(query: string|ExecuteSqlRequest): RunUpdatePromise;
runUpdate(query: string|ExecuteSqlRequest, callback: RunUpdateCallback): void;
/**
* Execute a DML statements and get the affected row count. Unlike
* Execute a DML statement and get the affected row count. Unlike
* {@link Transaction#runUpdate} after using this method you should
* immediately discard this transaction, internally it will invoke
* {@link PartitionedDml#end}.
Expand Down Expand Up @@ -1602,7 +1601,7 @@ export class PartitionedDml extends Dml {

/*! Developer Documentation
*
* All async methods (except for streams) will return a Promise in the event
* All async methods (except for streams) return a Promise in the event
* that a callback is omitted.
*/
promisifyAll(PartitionedDml);