Skip to content

Commit

Permalink
docs: add comments for UpdateResult (#993)
Browse files Browse the repository at this point in the history
Co-authored-by: Igal Klebanov <[email protected]>
  • Loading branch information
movahhedi and igalklebanov authored Jun 18, 2024
1 parent f1e53b3 commit 86fe331
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/driver/database-connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ export interface QueryResult<O> {
/**
* This is defined for update queries and contains the number of rows
* the query changed.
* This is optional and only provided by some drivers like node-mysql2.
*
* This is **optional** and only provided in dialects such as MySQL.
* You would probably use {@link numAffectedRows} in most cases.
*/
readonly numChangedRows?: bigint

Expand Down
10 changes: 10 additions & 0 deletions src/query-builder/update-result.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
export class UpdateResult {
/**
* The number of rows the update query updated (even if not changed).
*/
readonly numUpdatedRows: bigint

/**
* The number of rows the update query changed.
*
* This is **optional** and only supported in dialects such as MySQL.
* You would probably use {@link numUpdatedRows} in most cases.
*/
readonly numChangedRows?: bigint

constructor(numUpdatedRows: bigint, numChangedRows: bigint | undefined) {
Expand Down

0 comments on commit 86fe331

Please sign in to comment.