You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
384 B
26 lines
384 B
package query
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
type Callback func(ctx context.Context, iter interface{}) (err error)
|
|
type Callbacks []Callback
|
|
|
|
type (
|
|
OnDecode Callback
|
|
OnClose Callback
|
|
)
|
|
|
|
// Invoke callbacks sequence
|
|
func (c Callbacks) Invoke(ctx context.Context, iter interface{}) (err error) {
|
|
|
|
for _, cb := range c {
|
|
err = cb(ctx, iter)
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
|
|
return
|
|
}
|
|
|