blob: 49727001c7382f398ef84a5109e40fe6c832b421 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
package common
import (
"github.com/authzed/spicedb/pkg/datastore"
"github.com/authzed/spicedb/pkg/tuple"
)
// NewSliceRelationshipIterator creates a datastore.RelationshipIterator instance from a materialized slice of tuples.
func NewSliceRelationshipIterator(rels []tuple.Relationship) datastore.RelationshipIterator {
return func(yield func(tuple.Relationship, error) bool) {
for _, rel := range rels {
if !yield(rel, nil) {
break
}
}
}
}
|