NewSelectResults creates a Select Result parser that parses the response and returns a Reader that will return parsed and assembled select output.
(resp *http.Response, bucketName string)
| 477 | // NewSelectResults creates a Select Result parser that parses the response |
| 478 | // and returns a Reader that will return parsed and assembled select output. |
| 479 | func NewSelectResults(resp *http.Response, bucketName string) (*SelectResults, error) { |
| 480 | if resp.StatusCode != http.StatusOK { |
| 481 | return nil, httpRespToErrorResponse(resp, bucketName, "") |
| 482 | } |
| 483 | |
| 484 | pipeReader, pipeWriter := io.Pipe() |
| 485 | streamer := &SelectResults{ |
| 486 | resp: resp, |
| 487 | stats: &StatsMessage{}, |
| 488 | progress: &ProgressMessage{}, |
| 489 | pipeReader: pipeReader, |
| 490 | } |
| 491 | streamer.start(pipeWriter) |
| 492 | return streamer, nil |
| 493 | } |
| 494 | |
| 495 | // Close - closes the underlying response body and the stream reader. |
| 496 | func (s *SelectResults) Close() error { |
no test coverage detected