| 1 |
package callback |
| 2 |
|
| 3 |
import ( |
| 4 |
"fmt" |
| 5 |
) |
| 6 |
|
| 7 |
type Unsupported struct { |
| 8 |
Callback Interface |
| 9 |
} |
| 10 |
|
| 11 |
func (uc *Unsupported) Error() string { |
| 12 |
return fmt.Sprintf("Unsupported callback <%T>: %v", uc.Callback, uc.Callback) |
| 13 |
} |
| 14 |
|
| 15 |
type Interface interface { |
| 16 |
|
| 17 |
} |
| 18 |
|
| 19 |
type Handler interface { |
| 20 |
|
| 21 |
Handle(callbacks ...Interface) error |
| 22 |
} |
| 23 |
|
| 24 |
type HandlerFunc func(callbacks ...Interface) error |
| 25 |
|
| 26 |
func (f HandlerFunc) Handle(callbacks ...Interface) error { |
| 27 |
return f(callbacks...) |
| 28 |
} |