trie

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: MIT Imports: 13 Imported by: 0

README

trie

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(format string, v ...interface{})

Types

type Context

type Context struct {
	Writer     http.ResponseWriter
	Request    *http.Request
	Uri        string
	Method     string
	Parameters map[string]string
	StatusCode int
	// contains filtered or unexported fields
}

func NewContext

func NewContext(w http.ResponseWriter, r *http.Request) *Context

func (*Context) Cookie

func (c *Context) Cookie(key string) (string, error)

func (*Context) Data

func (c *Context) Data(code int, contentType string, data []byte)

func (*Context) Get

func (c *Context) Get(key string) string

func (*Context) Html

func (c *Context) Html(code int, name string, v interface{})

func (*Context) Json

func (c *Context) Json(code int, v interface{})

func (*Context) Jsonp

func (c *Context) Jsonp(code int, v interface{})

func (*Context) Param

func (c *Context) Param(key string) string

func (*Context) Post

func (c *Context) Post(key string) string

func (*Context) Render

func (c *Context) Render(code int, r Render)

func (*Context) SetHeader

func (c *Context) SetHeader(key string, value string)

func (*Context) Status

func (c *Context) Status(code int)

func (*Context) String

func (c *Context) String(code int, format string, v ...interface{})

func (*Context) Xml

func (c *Context) Xml(code int, v interface{})

func (*Context) Yaml

func (c *Context) Yaml(code int, v interface{})

type Data

type Data struct {
	ContentType string
	Data        []byte
}

func (Data) Render

func (d Data) Render(writer http.ResponseWriter) error

type Engine

type Engine struct {
	Router
	Template *template.Template
	FuncMap  template.FuncMap
	// contains filtered or unexported fields
}

func New added in v0.0.2

func New() *Engine

func (*Engine) HandleNotFound

func (e *Engine) HandleNotFound(c *Context, middleware []Middleware)

func (*Engine) LoadHtmlGlob

func (e *Engine) LoadHtmlGlob(pattern string)

func (*Engine) Run

func (e *Engine) Run(address string) (err error)

func (*Engine) RunTLS

func (e *Engine) RunTLS(address, cert, key string) (err error)

func (*Engine) ServeHTTP

func (e *Engine) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Engine) SetFuncMap

func (e *Engine) SetFuncMap(funcMap template.FuncMap)

type H

type H map[string]interface{}

type Handler

type Handler func(*Context)

type Html

type Html struct {
	Template *template.Template
	Name     string
	Data     interface{}
}

func (Html) Render

func (h Html) Render(writer http.ResponseWriter) error

type Json

type Json struct {
	Data interface{}
}

func (Json) Render

func (j Json) Render(writer http.ResponseWriter) (err error)

type Jsonp

type Jsonp struct {
	Callback string
	Data     interface{}
}

func (Jsonp) Render

func (jp Jsonp) Render(writer http.ResponseWriter) error

type Middleware

type Middleware func(next Handler) Handler

type Node

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

func NewNode

func NewNode(key string, depth int) *Node

type Parameter

type Parameter map[string]string

type Render

type Render interface {
	Render(http.ResponseWriter) error
}

type Router

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

func (*Router) Any

func (r *Router) Any(pattern string, handler Handler)

func (*Router) Delete

func (r *Router) Delete(pattern string, handler Handler)

func (*Router) Get

func (r *Router) Get(pattern string, handler Handler)

func (*Router) Group

func (r *Router) Group(prefix string) *Router

func (*Router) Handle

func (r *Router) Handle(method string, pattern string, handler Handler)

func (*Router) Head

func (r *Router) Head(pattern string, handler Handler)

func (*Router) Options

func (r *Router) Options(pattern string, handler Handler)

func (*Router) Patch

func (r *Router) Patch(pattern string, handler Handler)

func (*Router) Post

func (r *Router) Post(pattern string, handler Handler)

func (*Router) Put

func (r *Router) Put(pattern string, handler Handler)

func (*Router) Static

func (r *Router) Static(pattern, root string)

func (*Router) Use

func (r *Router) Use(middleware ...Middleware)

type String

type String struct {
	Format string
	Data   interface{}
}

func (String) Render

func (s String) Render(writer http.ResponseWriter) error

type Tree

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

func NewTree

func NewTree() *Tree

func (*Tree) Add

func (t *Tree) Add(pattern string, handle Handler, middleware ...Middleware)

func (*Tree) Find

func (t *Tree) Find(pattern string, isRegex bool) (nodes []*Node)

type Xml

type Xml struct {
	Data interface{}
}

func (Xml) Render

func (x Xml) Render(writer http.ResponseWriter) error

type Yaml

type Yaml struct {
	Data interface{}
}

func (Yaml) Render

func (y Yaml) Render(writer http.ResponseWriter) error

Jump to

Keyboard shortcuts

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