Skip to content

refactor: generate request payloads using generator functions - #1037

Merged
arthurschreiber merged 13 commits into
tediousjs:masterfrom
IanChokS:refactor-buffer
Jan 24, 2020
Merged

arthurschreiber merged 13 commits into
tediousjs:masterfrom
IanChokS:refactor-buffer

Conversation

@IanChokS

@IanChokS IanChokS commented Jan 17, 2020 •

Copy link
Copy Markdown
Member

When parameters or bulk load rows are converted from JavaScript values to actual TDS request payload data, a method called writeParameterData is currently used.

This method takes a WritableTrackingBuffer argument and stores the converted data type information in this tracking buffer. As part of #1038, we want to move to a model where this parameter data is not fully stored in one WritableTrackingBuffer before a request is written to the network, but instead we want to generate data in a streaming fashion and start sending data over the network as soon as possible.

This changeset adds a new generate generator method to all data types, which generates individual Buffers containing the same data as has been written by WritableTrackingBuffer so far. writeParameterData methods were update to make use of the generator objects returned by generate, until all of the request payload generation functionality gets updated to make use of the generator objects directly.

@IanChokS IanChokS changed the title test: first commit Refactor buffer generating using generator functions*() Jan 17, 2020
@IanChokS IanChokS changed the title Refactor buffer generating using generator functions*() Refactor generating buffers using generator functions*() Jan 17, 2020
@tediousjs tediousjs deleted a comment from codecov Bot Jan 18, 2020
@IanChokS
IanChokS marked this pull request as ready for review January 18, 2020 00:32
@IanChokS IanChokS closed this Jan 18, 2020
@IanChokS IanChokS reopened this Jan 18, 2020
@codecov

codecov Bot commented Jan 18, 2020 •

Copy link
Copy Markdown

Codecov Report

❗ No coverage uploaded for pull request base (master@20908d7). Click here to learn what that means.
The diff coverage is 82.22%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1037   +/-   ##
=========================================
  Coverage          ?   80.23%           
=========================================
  Files             ?       86           
  Lines             ?     4397           
  Branches          ?      780           
=========================================
  Hits              ?     3528           
  Misses            ?      614           
  Partials          ?      255
Impacted Files Coverage Δ
src/token/sspi-token-parser.ts 100% <ø> (ø)
src/data-types/tinyint.ts 91.66% <ø> (ø)
src/outgoing-message-stream.ts 100% <ø> (ø)
src/token/colmetadata-token-parser.ts 86.84% <ø> (ø)
src/token/nbcrow-token-parser.ts 75% <ø> (ø)
src/data-types/float.ts 100% <ø> (ø)
src/value-parser.ts 82.29% <ø> (ø)
src/debug.ts 100% <ø> (ø)
src/connection.ts 60.74% <ø> (ø)
src/data-types/varbinary.ts 67.39% <ø> (ø)
... and 42 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 20908d7...de189f0. Read the comment docs.

Comment thread src/data-type.ts Resolved
Comment thread src/data-types/datetime.ts Resolved
Comment thread test/unit/data-type.js Resolved
Comment thread test/unit/data-type.js Resolved
Comment thread test/unit/data-type.js Resolved
Comment thread src/data-types/bigint.ts Resolved
@arthurschreiber arthurschreiber changed the title Refactor generating buffers using generator functions*() refactor: generate request payloads using generator functions Jan 24, 2020
@arthurschreiber
arthurschreiber merged commit b2dc939 into tediousjs:master Jan 24, 2020
@arthurschreiber

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 8.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants