state/join: use Join method when available
Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
e431ab3c24
commit
1f74b636d3
@ -9,8 +9,19 @@ var (
|
|||||||
ErrDuplicate = errors.New("store contains duplicates")
|
ErrDuplicate = errors.New("store contains duplicates")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
|
Joiner is the interface that wraps the Join method.
|
||||||
|
|
||||||
|
The Join function uses Joiner if available.
|
||||||
|
*/
|
||||||
|
type Joiner interface{ Join() (Entries, error) }
|
||||||
|
|
||||||
// Join returns joined state entries of all active aids.
|
// Join returns joined state entries of all active aids.
|
||||||
func Join(s Store) (Entries, error) {
|
func Join(s Store) (Entries, error) {
|
||||||
|
if j, ok := s.(Joiner); ok {
|
||||||
|
return j.Join()
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
aids []int
|
aids []int
|
||||||
entries = make(Entries)
|
entries = make(Entries)
|
Loading…
Reference in New Issue
Block a user