ich

package module
v0.0.0-...-4ecddc6 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: Apache-2.0 Imports: 7 Imported by: 7

README

ich

A wrapper for the Chi router that adds named routes

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func (Builder) Name

func (n Builder) Name(name string)

type Mux

type Mux struct {
	chi.Router
	// contains filtered or unexported fields
}

func New

func New() *Mux

func (*Mux) BuildPath

func (m *Mux) BuildPath(name string, params ...any) (*url.URL, error)

TODO check if param value matches regex

func (*Mux) Connect

func (m *Mux) Connect(pattern string, h http.HandlerFunc) Builder

func (*Mux) Delete

func (m *Mux) Delete(pattern string, h http.HandlerFunc) Builder

func (*Mux) Get

func (m *Mux) Get(pattern string, h http.HandlerFunc) Builder

func (*Mux) Group

func (m *Mux) Group(fn func(r *Mux)) *Mux

func (*Mux) Handle

func (m *Mux) Handle(pattern string, h http.Handler) Builder

func (*Mux) HandleFunc

func (m *Mux) HandleFunc(pattern string, h http.HandlerFunc) Builder

func (*Mux) Head

func (m *Mux) Head(pattern string, h http.HandlerFunc) Builder

func (*Mux) Method

func (m *Mux) Method(method, pattern string, h http.Handler) Builder

func (*Mux) MethodFunc

func (m *Mux) MethodFunc(method, pattern string, h http.HandlerFunc) Builder

func (*Mux) Mount

func (m *Mux) Mount(pattern string, h http.Handler)

TODO allow name here (and prefix it to the nested names)?

func (*Mux) Options

func (m *Mux) Options(pattern string, h http.HandlerFunc) Builder

func (*Mux) Patch

func (m *Mux) Patch(pattern string, h http.HandlerFunc) Builder

func (*Mux) Path

func (m *Mux) Path(name string, pairs ...any) *url.URL

func (*Mux) Post

func (m *Mux) Post(pattern string, h http.HandlerFunc) Builder

func (*Mux) Put

func (m *Mux) Put(pattern string, h http.HandlerFunc) Builder

func (*Mux) Route

func (m *Mux) Route(pattern string, fn func(r *Mux)) *Mux

func (*Mux) Trace

func (m *Mux) Trace(pattern string, h http.HandlerFunc) Builder

func (*Mux) With

func (m *Mux) With(middlewares ...func(http.Handler) http.Handler) *Mux

Jump to

Keyboard shortcuts

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