Files
hatchet/internal/listutils/helpers.go
T
matt 73229b0e21 Feat: Run detail getter on the engine (#2725)
* feat: initial rpc

* chore: gen python

* feat: add more fields

* chore: gen again

* fix: finish cleaning up python

* feat: start wiring up api

* fix: panic

* feat: start implementing getters

* fix: improve api

* feat: expand return type a bit

* feat: more wiring

* feat: more wiring

* fix: finish wiring up input reads

* fix: admin client cleanup

* fix: ordering

* fix: add all_finished param

* feat: wire up all finished

* fix: propagate allfinished

* fix: propagate external ids

* chore: gen protos again

* fix: one more thing

* chore: rename

* chore: rename

* chore: fix typing

* fix: cleanup

* feat: add queued default

* fix: wiring

* feat: running check

* fix: query

* chore: rm print

* fix: edge case handling

* feat: python test

* feat: add `done` field

* feat: pass `done` through

* fix: test done flag

* fix: cleanup

* fix: handle cancelled

* refactor: clean up implementations of status handling

* fix: feedback

* fix: done logic

* fix: export run status

* fix: couple small bugs

* fix: handle done

* fix: properly extract input

* fix: bug with sequential dags

* refactor: improve performance of lookup query slightly

* refactor: add helpers on V1StepRunData for getting input + parsing bytes

* refactor: create listutils internal package

* refactor: status derivation

* fix: rm unused method

* fix: sqlcv1 import

* fix: error log

* fix: 404 on not found

* feat: changelog, async method
2026-01-08 12:44:01 -05:00

35 lines
581 B
Go

package listutils
func Uniq[T comparable](statuses []T) []T {
seen := make(map[T]struct{})
result := make([]T, 0)
for _, status := range statuses {
if _, ok := seen[status]; !ok {
seen[status] = struct{}{}
result = append(result, status)
}
}
return result
}
func Any[T comparable](statuses []T, target T) bool {
for _, status := range statuses {
if status == target {
return true
}
}
return false
}
func All[T comparable](statuses []T, target T) bool {
for _, status := range statuses {
if status != target {
return false
}
}
return true
}