Versions in this module Expand all Collapse all v0 v0.0.4 Jul 9, 2021 Changes in this version + const PARAM + const REGEX + const SUB + const WC + func PathValue(req *http.Request, key string) string + func Vars(req *http.Request) map[string]string + type Node struct + Compile map[int]*regexp.Regexp + Handler http.Handler + Kind int + Method string + Path string + Pattern map[int]string + Size int + Tag map[int]string + Token Token + func CurrentRoute(req *http.Request) *Node + func NewNode(mux *Router, url string, h http.Handler) *Node + func (r *Node) Match(req *http.Request) bool + func (r *Node) ServeHTTP(rw http.ResponseWriter, req *http.Request) + type Router struct + CaseSensitive bool + func NewRouter(routers ...router) *Router + func (m *Router) DELETE(path string, handler http.HandlerFunc) + func (m *Router) GET(path string, handler http.HandlerFunc) + func (m *Router) GetRequestRoute(req *http.Request) string + func (m *Router) HEAD(path string, handler http.HandlerFunc) + func (m *Router) Handle(path string, handler http.Handler) + func (m *Router) HandleFunc(path string, handler http.HandlerFunc) + func (m *Router) NotFound(handler http.Handler) + func (m *Router) NotFoundFunc(handler http.HandlerFunc) + func (m *Router) OPTIONS(path string, handler http.HandlerFunc) + func (m *Router) PATCH(path string, handler http.HandlerFunc) + func (m *Router) POST(path string, handler http.HandlerFunc) + func (m *Router) PUT(path string, handler http.HandlerFunc) + func (m *Router) Prefix(p string) *Router + func (m *Router) ServeHTTP(rw http.ResponseWriter, req *http.Request) + func (m *Router) SubRoute(path string, router http.Handler) + type Token struct + Size int + Tokens []string v0.0.3 Jun 8, 2021 v0.0.2 Jun 3, 2021 v0.0.1 Jun 3, 2021 Changes in this version + const DefaultTplSetName + const SupportPackageIsVersion1 + var TemplateEnv = "development" + func CheckResponse(_ context.Context, res *http.Response) error + func CleanPath(p string) string + func Do(client *http.Client, req *http.Request, target interface{}) error + func NewClient(ctx context.Context, opts ...ClientOption) (*http.Client, error) + func NewClientContext(ctx context.Context, info ClientInfo) context.Context + func NewServerContext(ctx context.Context, info ServerInfo) context.Context + func NewTransport(ctx context.Context, opts ...ClientOption) (http.RoundTripper, error) + func Process(h HandleOptions, w http.ResponseWriter, r *http.Request, ...) + type ClientInfo struct + Request *http.Request + func FromClientContext(ctx context.Context) (info ClientInfo, ok bool) + type ClientOption func(*clientOptions) + func WithMiddleware(m middleware.Middleware) ClientOption + func WithTimeout(d time.Duration) ClientOption + func WithTransport(trans http.RoundTripper) ClientOption + func WithUserAgent(ua string) ClientOption + type DecodeErrorFunc func(ctx context.Context, w *http.Response) error + type DecodeRequestFunc func(*http.Request, interface{}) error + type Delims struct + Left string + Right string + type EncodeErrorFunc func(http.ResponseWriter, *http.Request, error) + type EncodeResponseFunc func(http.ResponseWriter, *http.Request, interface{}) error + type HTMLOptions struct + Layout string + type HandleOption func(*HandleOptions) + func ErrorEncoder(en EncodeErrorFunc) HandleOption + func Middleware(m ...middleware.Middleware) HandleOption + func RequestDecoder(dec DecodeRequestFunc) HandleOption + func ResponseEncoder(en EncodeResponseFunc) HandleOption + type HandleOptions struct + Decode DecodeRequestFunc + Encode EncodeResponseFunc + Error EncodeErrorFunc + Middleware middleware.Middleware + func DefaultHandleOptions() HandleOptions + type HealthFunc func(ctx context.Context) error + type HealthHandler struct + func NewHealthHandler() *HealthHandler + func (h *HealthHandler) AddChecker(name string, c HealthFunc) + func (h *HealthHandler) AddObserver(name string, c HealthFunc) + func (h *HealthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) + type RenderOptions struct + AppendDirectories []string + Charset string + Delims Delims + Directory string + Extensions []string + Funcs []template.FuncMap + HTMLContentType string + Layout string + type Server struct + func NewServer(opts ...ServerOption) *Server + func (s *Server) Endpoint() (string, error) + func (s *Server) Handle(path string, h http.Handler) + func (s *Server) HandleFunc(path string, h http.HandlerFunc) + func (s *Server) PathPrefix(prefix string, h http.Handler) + func (s *Server) ServeHTTP(res http.ResponseWriter, req *http.Request) + func (s *Server) Start() error + func (s *Server) Stop() error + func (s *Server) Use(mwf ...mux.MiddlewareFunc) + type ServerInfo struct + Request *http.Request + Response http.ResponseWriter + func FromServerContext(ctx context.Context) (info ServerInfo, ok bool) + type ServerOption func(*Server) + func Address(addr string) ServerOption + func Logger(logger log.Logger) ServerOption + func Network(network string) ServerOption + func Timeout(timeout time.Duration) ServerOption + type TemplateFile interface + Data func() []byte + Ext func() string + Name func() string + type TemplateFileSystem interface + Get func(string) (io.Reader, error) + ListFiles func() []TemplateFile + type TemplateSet struct + func NewTemplateSet() *TemplateSet + func (ts *TemplateSet) Get(name string) *template.Template + func (ts *TemplateSet) GetDir(name string) string + func (ts *TemplateSet) Set(name string, opt *RenderOptions) *template.Template + type TplFile struct + func NewTplFile(name string, data []byte, ext string) *TplFile + func (f *TplFile) Data() []byte + func (f *TplFile) Ext() string + func (f *TplFile) Name() string + type TplFileSystem struct + func NewTemplateFileSystem(opt RenderOptions, omitData bool) TplFileSystem + func (fs TplFileSystem) Get(name string) (io.Reader, error) + func (fs TplFileSystem) ListFiles() []TemplateFile + type TplRender struct + Charset string + Opt *RenderOptions + func (r *TplRender) HTML(status int, name string, data interface{}, htmlOpt ...HTMLOptions) + func (r *TplRender) HTMLSet(status int, setName, tplName string, data interface{}, htmlOpt ...HTMLOptions) + func (r *TplRender) HTMLSetBytes(setName, tplName string, data interface{}, htmlOpt ...HTMLOptions) ([]byte, error)