package controllers import ( "pink_fox/inner/commands" "pink_fox/packages/fw" "strings" ) type SiteController struct { services SiteControllerService } type SiteControllerService interface { fw.BaseServices } func NewSiteController(services SiteControllerService) *SiteController { return &SiteController{ services: services, } } func (it *SiteController) Index() (fw.Response, fw.Error) { //return it.services.ResponseFactory().HtmlError(404, "test"), nil //return nil, fw.ErrStr("site controller not yet implemented") return it.services.ResponseFactory().View("index.html", map[string]any{ "text": "Hello world", }), nil } type TestActionServices interface { UserCommand() *commands.UserCommand } func (it *SiteController) Test(services TestActionServices) (fw.Response, fw.Error) { getUserList, err := services.UserCommand().CheckAndFind(100) if err != nil { return nil, err.Tap() } list, err := getUserList(1000) if err != nil { return nil, err.Tap() } return it.services.ResponseFactory().String(strings.Join(list, ", ")), nil }