MCPcopy Create free account
hub / github.com/DOSNetwork/core / first

Function first

onchain/eth_helpers.go:33–53  ·  view source on GitHub ↗
(ctx context.Context, source <-chan interface{})

Source from the content-addressed store, hash-verified

31}
32
33func first(ctx context.Context, source <-chan interface{}) <-chan interface{} {
34 out := make(chan interface{})
35 go func() {
36 defer close(out)
37 first := true
38 for val := range source {
39 if first {
40 if val != nil {
41 first = false
42 select {
43 case <-ctx.Done():
44 return
45 case out <- val:
46 }
47 return
48 }
49 }
50 }
51 }()
52 return out
53}
54
55func merge(ctx context.Context, cs ...chan interface{}) chan interface{} {
56 var wg sync.WaitGroup

Callers 1

getMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected