Documentation
¶
Overview ¶
Copyright 2022 DomineCore. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.
Copyright 2022 DomineCore. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.
Copyright 2022 DomineCore. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.
Copyright 2022 DomineCore. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.
Copyright 2022 DomineCore. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.
Copyright 2022 DomineCore. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.
Index ¶
- Variables
- func SetConf(path string, name string, filetype string)
- type Brisk
- func (b *Brisk) Get(pattern string, handler HandleFunc)
- func (b *Brisk) LoadConfig(configpath string)
- func (b *Brisk) LoadDataBase()
- func (b *Brisk) Post(pattern string, handler HandleFunc)
- func (b *Brisk) Run(addr string) (err error)
- func (b *Brisk) ServeHTTP(w http.ResponseWriter, req *http.Request)
- type Conf
- type Context
- func (c *Context) AddHeader(key string, value string)
- func (c *Context) Data(code int, data []byte)
- func (c *Context) Form(key string) string
- func (c *Context) HTML(code int, html string)
- func (c *Context) JsonBind(obj interface{}) error
- func (c *Context) QueryParams(key string) string
- func (c *Context) SetHeader(key string, value string)
- func (c *Context) SetStatusCode(code int)
- func (c *Context) WriteJSON(code int, obj interface{})
- func (c *Context) WriteString(code int, format string, values ...interface{})
- type CrosMiddleware
- type DBConnector
- type DBEngine
- type HandleFunc
- type LoggingMiddleware
- type MiddleWare
- type MySQL
- type Node
- type Router
- type Trie
Constants ¶
This section is empty.
Variables ¶
var DB *gorm.DB
Functions ¶
Types ¶
type Brisk ¶
type Brisk struct {
Router *Router
}
func (*Brisk) Get ¶
func (b *Brisk) Get(pattern string, handler HandleFunc)
func (*Brisk) LoadConfig ¶ added in v1.2.2
func (*Brisk) LoadDataBase ¶ added in v1.2.2
func (b *Brisk) LoadDataBase()
func (*Brisk) Post ¶
func (b *Brisk) Post(pattern string, handler HandleFunc)
type Context ¶
type Context struct { // 原始结构封装 Request *http.Request ResponseWriter http.ResponseWriter // 请求信息 Path string Method string PathParams map[string]string // 用于存储动态路径查询参数 example: "/goods/:id/" -- > {"id":123} // 响应信息 StatusCode int }
func NewContext ¶
func NewContext(w http.ResponseWriter, r *http.Request) *Context
func (*Context) QueryParams ¶
func (*Context) SetStatusCode ¶
func (*Context) WriteString ¶
type CrosMiddleware ¶
type CrosMiddleware struct{}
type DBConnector ¶ added in v1.2.2
type DBConnector struct {
DriverName string // driver_name: mysql/ sqlite/ postgresql/ sqlserver
}
func NewDBConnector ¶ added in v1.2.2
func NewDBConnector() *DBConnector
func (*DBConnector) Connect ¶ added in v1.2.2
func (db *DBConnector) Connect()
type HandleFunc ¶
type HandleFunc func(c *Context)
type LoggingMiddleware ¶
type LoggingMiddleware struct{}
type MiddleWare ¶
type MiddleWare interface {
// contains filtered or unexported methods
}
type MySQL ¶ added in v1.2.2
type Router ¶
type Router struct { Middlewares []MiddleWare // contains filtered or unexported fields }
func (*Router) Use ¶
func (r *Router) Use(middleware MiddleWare)
type Trie ¶
type Trie struct {
// contains filtered or unexported fields
}