31 lines
521 B
Go
31 lines
521 B
Go
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
|
|
package fixture
|
|
|
|
import (
|
|
)
|
|
|
|
type Result interface{}
|
|
|
|
type ResultReader interface {
|
|
Values() []Result
|
|
Read() <-chan Result
|
|
}
|
|
|
|
type Results struct {
|
|
values []Result
|
|
}
|
|
|
|
func R(v []Result) *Results { return &Results{ values: v } }
|
|
|
|
func (r *Results) Values() []Result {
|
|
return r.values
|
|
}
|
|
|
|
func (r *Results) Read() <-chan Result {
|
|
rc := make(chan Result, len(r.values))
|
|
for i := range(r.Values()) {
|
|
rc <- i
|
|
}
|
|
return rc
|
|
}
|