diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-02-14 14:11:02 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-02-14 14:11:02 +0900 |
| commit | 1f74b636d31e816907ff6adbf1472f9e0fb37ab7 (patch) | |
| tree | 5aecb9dbf912d5e2fae089f88adeeeb49bb01103 | |
| parent | e431ab3c24acc5309531a26d71e761619bd69eec (diff) | |
state/join: use Join method when available
Signed-off-by: Ophestra <cat@gensokyo.uk>
| -rw-r--r-- | internal/state/join.go (renamed from internal/state/util.go) | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/state/util.go b/internal/state/join.go index 473ae51d..2b4011fe 100644 --- a/internal/state/util.go +++ b/internal/state/join.go @@ -9,8 +9,19 @@ var ( 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. func Join(s Store) (Entries, error) { + if j, ok := s.(Joiner); ok { + return j.Join() + } + var ( aids []int entries = make(Entries) |
