35 lines
537 B
Go
35 lines
537 B
Go
package executetest
|
|
|
|
import "github.com/influxdata/platform/query"
|
|
|
|
type Result struct {
|
|
Blks []*Block
|
|
}
|
|
|
|
func NewResult(blocks []*Block) *Result {
|
|
return &Result{Blks: blocks}
|
|
}
|
|
|
|
func (r *Result) Blocks() query.BlockIterator {
|
|
return &BlockIterator{
|
|
r.Blks,
|
|
}
|
|
}
|
|
|
|
func (r *Result) Normalize() {
|
|
NormalizeBlocks(r.Blks)
|
|
}
|
|
|
|
type BlockIterator struct {
|
|
blocks []*Block
|
|
}
|
|
|
|
func (bi *BlockIterator) Do(f func(query.Block) error) error {
|
|
for _, b := range bi.blocks {
|
|
if err := f(b); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|