MCPcopy Index your code
hub / github.com/riverqueue/river / FirstNonEmpty

Function FirstNonEmpty

rivershared/util/sliceutil/slice_util.go:9–16  ·  view source on GitHub ↗

FirstNonEmpty returns the first non-empty slice from the input, or nil if all input slices are empty.

(inputs ...[]T)

Source from the content-addressed store, hash-verified

7// FirstNonEmpty returns the first non-empty slice from the input, or nil if
8// all input slices are empty.
9func FirstNonEmpty[T any](inputs ...[]T) []T {
10 for _, input := range inputs {
11 if len(input) > 0 {
12 return input
13 }
14 }
15 return nil
16}
17
18// GroupBy returns an object composed of keys generated from the results of
19// running each element of collection through keyFunc.

Callers 10

JobInsertFastManyMethod · 0.92
JobInsertFullManyMethod · 0.92
JobInsertFullManyMethod · 0.92
JobInsertFullMethod · 0.92
QueueUpdateMethod · 0.92
TestFirstNonEmptyFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestFirstNonEmptyFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…