core

package
v0.0.0-...-45beecb Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package core @Author Bing @Date 2023/9/26 21:09:00 @Desc

Package core @Author Bing @Date 2023/10/7 17:04:00 @Desc

Package core @Author Bing @Date 2023/9/26 21:09:00 @Desc

Package core @Author Bing @Date 2023/10/16 12:27:00 @Desc

Package core @Author Bing @Date 2023/9/26 21:09:00 @Desc

Package core @Author Bing @Date 2023/10/9 17:41:00 @Desc

Package core @Author Bing @Date 2023/10/11 13:20:00 @Desc

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parsers

func Parsers(s string) []string

Types

type Context

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

Context @Description: request response Context management

func (*Context) Data

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

func (*Context) HTML

func (c *Context) HTML(code int, name string, data any)

func (*Context) JSON

func (c *Context) JSON(obj config.H)

func (*Context) MultipartFile

func (c *Context) MultipartFile() (*multipart.Form, error)

func (*Context) Next

func (c *Context) Next()

func (*Context) Param

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

func (*Context) PostFile

func (c *Context) PostFile(name string) (*multipart.FileHeader, error)

func (*Context) PostForm

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

func (*Context) SaveUploadFile

func (c *Context) SaveUploadFile(fileHeader *multipart.FileHeader, fp string) error

func (*Context) SetHeader

func (c *Context) SetHeader(rType string)

func (*Context) String

func (c *Context) String(code int, format string, data ...config.H)

type Engine

type Engine struct {
	//*Route  `json:"route"`
	*Trie `json:"trie"`
	*Group
	Address string `json:"address"`
	Port    string `json:"port"`
	// contains filtered or unexported fields
}

Engine @Description: 核心组件: 主要承载 官方组件 http server(实现 server 接口)

func NewEngine

func NewEngine(address, port string) *Engine

func (*Engine) LoadHtml

func (e *Engine) LoadHtml(path string)

func (*Engine) Run

func (e *Engine) Run()

Run @Description: 启动函数

func (*Engine) ServeHTTP

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

ServeHTTP @Description: 实现 http Handler 接口 @param w http.ResponseWriter @param r *http.Request

type Group

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

func (*Group) AddRoute

func (g *Group) AddRoute(method, path string, handle Handle)

func (*Group) DELETE

func (g *Group) DELETE(path string, handle Handle)

func (*Group) GET

func (g *Group) GET(path string, handle Handle)

func (*Group) NewGroup

func (g *Group) NewGroup(prefix string) *Group

func (*Group) POST

func (g *Group) POST(path string, handle Handle)

func (*Group) PUT

func (g *Group) PUT(path string, handle Handle)

func (*Group) Static

func (g *Group) Static(path string)

func (*Group) Use

func (g *Group) Use(handle Handle)

type Handle

type Handle func(*Context)

type Route

type Route struct {
	Context Context           `json:"context"`
	Maps    map[string]Handle `json:"maps"`
}

func NewRoute

func NewRoute() *Route

func (*Route) GET

func (r *Route) GET(path string, handle Handle)

type Trie

type Trie struct {
	Nodes map[string]*node `json:"nodes"`
}

func NewTrie

func NewTrie() *Trie

func (*Trie) DELETE

func (t *Trie) DELETE(pattern string, handle Handle)

func (*Trie) GET

func (t *Trie) GET(pattern string, handle Handle)

func (*Trie) POST

func (t *Trie) POST(pattern string, handle Handle)

func (*Trie) PUT

func (t *Trie) PUT(pattern string, handle Handle)

Jump to

Keyboard shortcuts

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