hypergo

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

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

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 9 Imported by: 0

README

hypergo

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmptyWrap

func EmptyWrap(rw *RW, c templ.Component) templ.Component

func NewComponent

func NewComponent(handler ComponentHandler) *component

func NewRequestValidator

func NewRequestValidator() *requestValidator

func NoWhiteSpace

func NoWhiteSpace(s string) error

func RequireInt

func RequireInt(str string) error

func TryValidate

func TryValidate()

func UsernameValidator

func UsernameValidator(value string, validators ...StringValidatorFunc) *stringValidator

Types

type Catcher

type Catcher func(rw *RW, err error) error

type Component

type Component interface {
	Catch(catcher ComponentErrCatcher) Component
	// contains filtered or unexported methods
}

type ComponentErrCatcher

type ComponentErrCatcher func(rw *RW, component templ.Component, err error) (templ.Component, error)

type ComponentFunc

type ComponentFunc func(rw *RW) templ.Component

func SimpleComponent

func SimpleComponent(fn func() templ.Component) ComponentFunc

type ComponentHandler

type ComponentHandler func(rw *RW) (templ.Component, error)

func SimpleHandler

func SimpleHandler(fn func() templ.Component) ComponentHandler

type ComponentWrapper

type ComponentWrapper func(rw *RW, c templ.Component) templ.Component

func SimpleWrapper

func SimpleWrapper(fn func(c templ.Component) templ.Component) ComponentWrapper

type Handler

type Handler interface {
	Catch(catcher ...Catcher) Handler
	HandleFunc() HandlerFunc
	// contains filtered or unexported methods
}

func NewHandler

func NewHandler(h func(rw *RW) error) Handler

type HandlerFunc

type HandlerFunc func(rw *RW)

type HyperGo

type HyperGo struct {
	*Router
	// contains filtered or unexported fields
}

func New

func New(target string) *HyperGo

func (*HyperGo) Listen

func (h *HyperGo) Listen(addr string)

type Middleware

type Middleware func(h HandlerFunc) HandlerFunc

type Num

type Num int

type Pill

type Pill int
const (
	Placebo Pill = iota
	Aspirin
	Ibuprofen
	Paracetamol
	Acetaminophen = Paracetamol
)

type PrimitiveMap

type PrimitiveMap map[string]ValidatedPrimitive

type RW

type RW struct {
	http.ResponseWriter
	*http.Request
	// contains filtered or unexported fields
}

func (*RW) Boosted

func (rw *RW) Boosted() bool

func (*RW) CurrentUrl

func (rw *RW) CurrentUrl() *url.URL

func (*RW) ExecutedScripts

func (rw *RW) ExecutedScripts() []string

Custom Headers

func (*RW) IsHistoryRestoreRequest

func (rw *RW) IsHistoryRestoreRequest() bool

func (*RW) IsHxRequest

func (rw *RW) IsHxRequest() bool

func (*RW) Location

func (rw *RW) Location(url string)

func (*RW) PathHasPrefix

func (rw *RW) PathHasPrefix(subPath string) bool

Other

func (*RW) Prompt

func (rw *RW) Prompt() string

func (*RW) Redirect

func (rw *RW) Redirect(location string)

func (*RW) Refresh

func (rw *RW) Refresh()

Response Headers

func (*RW) ReplaceUrl

func (rw *RW) ReplaceUrl(url string)

func (*RW) Reselect

func (rw *RW) Reselect(target string)

func (*RW) Reswap

func (rw *RW) Reswap(swapMethod string)

func (*RW) Retarget

func (rw *RW) Retarget(target string)

func (*RW) StripPrefix

func (rw *RW) StripPrefix(prefix string)

func (*RW) Target

func (rw *RW) Target() string

Request Headers

func (*RW) TriggerId

func (rw *RW) TriggerId() string

func (*RW) TriggerName

func (rw *RW) TriggerName() string

type RequestValidator

type RequestValidator interface {
	Validate(req *http.Request) (map[string]ValidatedPrimitive, []error)
}

type Route

type Route interface {
	Handler() http.HandlerFunc
	Use(m Middleware)
	PrependMiddleware(m ...Middleware)
	FullPath() string
}

type Router

type Router struct {
	Parent     *Router
	Path       string
	Routes     []Route
	Middleware []Middleware
	SubRouters []*Router
	Wrapper    ComponentWrapper
	Target     string
}

func NewRouter

func NewRouter(target string) *Router

func (*Router) Delete

func (router *Router) Delete(path string, h HandlerFunc) *Router

func (*Router) FullPath

func (router *Router) FullPath() string

func (*Router) Get

func (router *Router) Get(path string, h HandlerFunc) *Router

func (*Router) GetComponent

func (router *Router) GetComponent(path string, c ComponentFunc) ComponentFunc

func (*Router) Patch

func (router *Router) Patch(path string, h HandlerFunc) *Router

func (*Router) Post

func (router *Router) Post(path string, h HandlerFunc) *Router

func (*Router) Put

func (router *Router) Put(path string, h HandlerFunc) *Router

func (*Router) SetTarget

func (router *Router) SetTarget(target string)

func (*Router) SubRouter

func (router *Router) SubRouter(path string, subrouter *Router)

func (*Router) Use

func (router *Router) Use(m Middleware)

func (*Router) Wrap

func (router *Router) Wrap(w ComponentWrapper) *Router
type Search struct {
	QueryString string
	ResultCount int
}

func NewSearch

func NewSearch(r *http.Request) (*Search, []error)

type StringValidator

type StringValidator interface {
	Validate(s string) []error
	Use(s ...StringValidatorFunc) StringValidator
}

type StringValidatorFunc

type StringValidatorFunc func(s string) error

func RequireMaxLen

func RequireMaxLen(maxLen int) StringValidatorFunc

func RequireMinLen

func RequireMinLen(minLength int) StringValidatorFunc

type User

type User struct {
	FirstName  string
	LastName   string
	Age        int
	Email      string
	BirthMonth string
}

func NewUser

func NewUser(r *http.Request) (*User, []error)

type ValidatedPrimitive

type ValidatedPrimitive interface {
	String() string
	Int() int
}

type WrapCatcher

type WrapCatcher func(rw *RW, component templ.Component, err error) (templ.Component, error)

type WrapFunc

type WrapFunc func(rw *RW, component templ.Component) (templ.Component, error)

func UnsafeWrapFunc

func UnsafeWrapFunc(fn func(component templ.Component) templ.Component) WrapFunc

type Wrapper

type Wrapper interface {
	Catch(w WrapCatcher) Wrapper
	Wrap(w WrapFunc) Wrapper
	// contains filtered or unexported methods
}

Directories

Path Synopsis
cmd
app command
generators/stringer command
Stringer is a tool to automate the creation of methods that satisfy the fmt.Stringer interface.
Stringer is a tool to automate the creation of methods that satisfy the fmt.Stringer interface.
templ: version: v0.3.857
templ: version: v0.3.857

Jump to

Keyboard shortcuts

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