/* Handler Information: Route: /{{.Path}} Has View:{{ if .GetView }} yes {{ else }} no {{ end }} Needs Auth:{{ if .RequireAuth }} yes {{ else }} no {{ end }} */ package {{.PackagePath}} import ( "github.com/go-webauthn/webauthn/webauthn" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/session" "github.com/uptrace/bun" "go.uber.org/zap" {{- if .GetView }} "{{.ModulePath}}/web/utils" {{ end }} . "{{.ModulePath}}/web/utils/handler" {{- if .GetView }} PAGE_VIEW "{{.ModulePath}}/web/views/{{.Path}}" {{ end }} ) func init() { Register(&{{.UpperName}}Handler{Path: "{{.Path}}"}) } type {{.UpperName}}Handler struct { Path string {{ if .RequireAuth }}`omnibill:"requireAuth"`{{ end }} Db *bun.DB Logger *zap.Logger AuthSessionStore *session.Store SessionStore *session.Store Session *session.Session AuthSession *session.Session WebAuthn *webauthn.WebAuthn } {{- if .GetView }} func (h {{.UpperName}}Handler) Get(c *fiber.Ctx) error { return utils.Render(c, PAGE_VIEW.Show()) } {{ end -}} {{- if .GetNoView }} func (h {{.UpperName}}Handler) Get(c *fiber.Ctx) error { return nil } {{ end -}} {{- if .Post }} func (h {{.UpperName}}Handler) Post(c *fiber.Ctx) error { return nil } {{ end -}} {{- if .Put }} func (h {{.UpperName}}Handler) Put(c *fiber.Ctx) error { return nil } {{ end -}} {{- if .Delete }} func (h {{.UpperName}}Handler) Delete(c *fiber.Ctx) error { return nil } {{ end -}} {{- if .Options }} func (h {{.UpperName}}Handler) Options(c *fiber.Ctx) error { return nil } {{ end -}} {{- if .Head }} func (h {{.UpperName}}Handler) Head(c *fiber.Ctx) error { return nil } {{ end -}} {{- if .Patch }} func (h {{.UpperName}}Handler) Patch(c *fiber.Ctx) error { return nil } {{ end -}}