35 lines
715 B
Go
35 lines
715 B
Go
package handler
|
|
|
|
import (
|
|
"reflect"
|
|
|
|
"github.com/iancoleman/strcase"
|
|
"github.com/spf13/viper"
|
|
|
|
"git.amok.space/yevhen/resource-scraper/pkg/service"
|
|
"git.amok.space/yevhen/resource-scraper/types/constant"
|
|
)
|
|
|
|
type Handler struct {
|
|
services *service.Service
|
|
}
|
|
|
|
func New(services *service.Service) *Handler {
|
|
return &Handler{services: services}
|
|
}
|
|
|
|
func (h *Handler) InitConsole() string {
|
|
methodName := strcase.ToCamel(viper.GetString(constant.FlagScopeEnable))
|
|
|
|
immutable := reflect.ValueOf(h)
|
|
method := immutable.MethodByName(methodName)
|
|
v := method.Call(nil)
|
|
|
|
return methodName + " launched, " + v[0].String() + "\n"
|
|
}
|
|
|
|
func (h *Handler) InitRoutes() string {
|
|
//TODO:
|
|
return "i am the web initiator"
|
|
}
|