feat: make the CoreAPI expose a streaming pin interface#38
feat: make the CoreAPI expose a streaming pin interface#38
Conversation
|
Turns out I'm hitting this one because I need the I'm hesitating between several options: Ls(context.Context, ...options.PinLsOption) (<-chan Pin, error)The one you suggested in this PR. Ls(context.Context, ...options.PinLsOption) (<-chan Pin, <-chan error)Pro: errors while streaming can be returned. A bit clunky to use but less that the third solution This API can be used like this: var result []iface.Pin
pins, errC := api.Pin().Ls(ctx)
for pin := range pins {
result = append(result, pin)
}
if err := <-errC; err != nil {
return nil, err
}Third option: Ls(context.Context, ...options.PinLsOption) (<-chan Pin, <-chan error, error)Pro: errors while streaming can be returned. Simpler to implement. Any preference ? |
|
Maybe better: I'm going for this solution. |
No description provided.