gohandle

package module
v0.0.0-...-ea35338 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const LOCAL_ENV_VAR = "GOHANDLE_LOCAL"

Variables

This section is empty.

Functions

func Run

func Run(handlers []Handler)

Types

type Function

type Function interface {
	Name() string
	Func() any
}

func Mod

func Mod() Function

func NewFunction

func NewFunction(name string, f any) Function

func Plus

func Plus() Function

type Handler

type Handler interface {
	http.Handler
	GetPattern() string
}

type PostHandler

type PostHandler[T any] struct {
	Pattern    string
	HandleFunc func(T) error
}

func (*PostHandler[T]) GetPattern

func (ph *PostHandler[T]) GetPattern() string

func (*PostHandler[T]) ServeHTTP

func (ph *PostHandler[T]) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RedirectHandler

type RedirectHandler struct {
	Pattern string
	Dest    string
}

func (*RedirectHandler) GetPattern

func (rh *RedirectHandler) GetPattern() string

func (*RedirectHandler) ServeHTTP

func (rh *RedirectHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Request

type Request struct{}

type TemplateFile

type TemplateFile string

func Join

func Join(ss ...string) TemplateFile

type TemplateFiles

type TemplateFiles []TemplateFile

type TemplateHandler

type TemplateHandler struct {
	Pattern      string
	Template     TemplateFile
	Templates    TemplateFiles
	Functions    []Function
	GenerateData func(r *http.Request) (any, error)
}

func (*TemplateHandler) GetPattern

func (sh *TemplateHandler) GetPattern() string

func (*TemplateHandler) ServeHTTP

func (sh *TemplateHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL