Skip to content

adds FromReader function#46

Open
darwayne wants to merge 1 commit intoTcM1911:masterfrom
darwayne:enhancements
Open

adds FromReader function#46
darwayne wants to merge 1 commit intoTcM1911:masterfrom
darwayne:enhancements

Conversation

@darwayne
Copy link

This adds the ability for a user to generate a collection directly from a reader

@codecov
Copy link

codecov bot commented May 13, 2022

Codecov Report

Merging #46 (1bc5515) into master (91e5499) will decrease coverage by 0.29%.
The diff coverage is 72.72%.

@@            Coverage Diff             @@
##           master      #46      +/-   ##
==========================================
- Coverage   99.29%   99.00%   -0.30%     
==========================================
  Files          43       43              
  Lines        1981     2003      +22     
==========================================
+ Hits         1967     1983      +16     
- Misses          7       10       +3     
- Partials        7       10       +3     
Impacted Files Coverage Δ
stix.go 98.53% <72.72%> (-1.09%) ⬇️

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 91e5499...1bc5515. Read the comment docs.

return obj
}

func FromReader(reader io.Reader, opts ...CollectionOption) (*Collection, error) {
Copy link
Owner

Choose a reason for hiding this comment

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

Please add documentation to this function since it's exported.

collection := New(opts...)
buff := bufio.NewReader(reader)
piece, err := buff.Peek(10)
if err != nil && !(err == io.EOF || err == bufio.ErrBufferFull) {
Copy link
Owner

Choose a reason for hiding this comment

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

Can you add tests for this since it's checking for specific error cases?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants