20 lines
379 B
Go
20 lines
379 B
Go
|
package common
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"errors"
|
||
|
"runtime"
|
||
|
)
|
||
|
|
||
|
type ReactiveHandlerOnOS struct {
|
||
|
HandleFunc map[string]func(ctx context.Context) (context.Context, error)
|
||
|
}
|
||
|
|
||
|
func (h *ReactiveHandlerOnOS) Handle(ctx context.Context) (context.Context, error) {
|
||
|
handle, ok := h.HandleFunc[runtime.GOOS]
|
||
|
if !ok {
|
||
|
return nil, errors.New("unsupported error")
|
||
|
}
|
||
|
return handle(ctx)
|
||
|
}
|