Documentation ¶
Index ¶
- Constants
- Variables
- func ComplementHex(s string, x int) string
- func CreateUUID(xtr []byte) []byte
- func NewSession(types int)
- func Random() []byte
- func Sha1(b []byte) []byte
- func SplitString(str []byte, p []byte) []string
- type AutoRegister
- type Core
- func (co *Core) BasicAuth(args ...string) bool
- func (co *Core) Byte(s string) []byte
- func (co *Core) Decode(method int, scan interface{}) []byte
- func (co *Core) Json(data ...interface{}) *json
- func (co *Core) Plugin(name string) plugin
- func (co *Core) String(b []byte) string
- func (co *Core) View() *view
- type DynamicRoute
- type Encryption
- type GlobalFunc
- type Groups
- func (mux *Groups) Connect(path string, handlerFunc HandlerFunc, middleName ...string)
- func (mux *Groups) Delete(path string, handlerFunc HandlerFunc, middleName ...string)
- func (mux *Groups) Get(path string, handlerFunc HandlerFunc, middleName ...string)
- func (mux *Groups) Group(path string, fn func(groups *Groups))
- func (mux *Groups) Head(path string, handlerFunc HandlerFunc, middleName ...string)
- func (mux *Groups) Middleware(name string, fn func(w http.ResponseWriter, r *http.Request, co *Core) bool)
- func (mux *Groups) Options(path string, handlerFunc HandlerFunc, middleName ...string)
- func (mux *Groups) Patch(path string, handlerFunc HandlerFunc, middleName ...string)
- func (mux *Groups) Post(path string, handlerFunc HandlerFunc, middleName ...string)
- func (mux *Groups) Put(path string, handlerFunc HandlerFunc, middleName ...string)
- func (mux *Groups) Trace(path string, handlerFunc HandlerFunc, middleName ...string)
- type HandlerFunc
- type Plugin
- type SX
- type Session
- type Son
- type Trie
- func (mux *Trie) AutoRegister(auto interface{}) *AutoRegister
- func (mux *Trie) Connect(path string, handlerFunc HandlerFunc, middleName ...string)
- func (mux *Trie) Delete(path string, handlerFunc HandlerFunc, middleName ...string)
- func (mux *Trie) Dynamic(ymlPath string)
- func (mux *Trie) Find(key string, methods string) (string, HandlerFunc, http.Handler, string, string, bool)
- func (mux *Trie) Get(path string, handlerFunc HandlerFunc, middleName ...string)
- func (mux *Trie) GlobalFunc(name string, fn func(w http.ResponseWriter, r *http.Request, co *Core) error)
- func (mux *Trie) Group(path string, fn func(groups *Groups))
- func (mux *Trie) Head(path string, handlerFunc HandlerFunc, middleName ...string)
- func (mux *Trie) HttpProxy(dr *DynamicRoute) func(w http.ResponseWriter, r *http.Request, core *Core)
- func (mux *Trie) Middle(name string, fn func(w http.ResponseWriter, r *http.Request, co *Core) bool)
- func (mux *Trie) Middleware(name string, fn func(w http.ResponseWriter, r *http.Request, co *Core) bool)
- func (mux *Trie) Options(path string, handlerFunc HandlerFunc, middleName ...string)
- func (mux *Trie) Patch(path string, handlerFunc HandlerFunc, middleName ...string)
- func (mux *Trie) Plugin(pluginStruct interface{})
- func (mux *Trie) Post(path string, handlerFunc HandlerFunc, middleName ...string)
- func (mux *Trie) Put(path string, handlerFunc HandlerFunc, middleName ...string)
- func (mux *Trie) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (mux *Trie) SetDebug()
- func (mux *Trie) SetEncryption(e Encryption)
- func (mux *Trie) SetLayout(path ...string)
- func (mux *Trie) SetView(path string)
- func (mux *Trie) StopSession()
- func (mux *Trie) Trace(path string, handlerFunc HandlerFunc, middleName ...string)
Constants ¶
View Source
const ( LOCAL = iota SpruceLocal SPRUCE )
View Source
const ( DECODE_JSON = iota DECODE_QUERY )
View Source
const (
TypeJson = "application/json"
)
Variables ¶
View Source
var ( Debug = false Layout []string OUT = "./view" )
add new component view render
View Source
var ( X *spruce.Hash OP = -1 )
这里是session组件的存 默认是 启用 开源通过 r.StopSession关闭 现版本是只能启用 LOCAL模式
View Source
var FileType = map[string]string{"html": "text/html", "json": "application/json", "css": "text/css", "txt": "text/plain", "zip": "application/x-zip-compressed", "png": "image/png", "jpg": "image/jpeg"}
Functions ¶
func ComplementHex ¶
func CreateUUID ¶
func NewSession ¶
func NewSession(types int)
func SplitString ¶
Types ¶
type Core ¶
type Core struct { PL *Plugin Session Session EncryptFunc Encryption // contains filtered or unexported fields }
func (*Core) BasicAuth ¶ added in v1.1.0
2020/8/31 add basic auth component arg doubles include name and pass like this BasicAuth("user","pass","user2","pass2") , it's true BasicAuth("user","pass","user2") , it's false
type DynamicRoute ¶
type Encryption ¶ added in v1.3.0
type GlobalFunc ¶
type Groups ¶
func (*Groups) Connect ¶ added in v1.1.0
func (mux *Groups) Connect(path string, handlerFunc HandlerFunc, middleName ...string)
func (*Groups) Delete ¶
func (mux *Groups) Delete(path string, handlerFunc HandlerFunc, middleName ...string)
func (*Groups) Get ¶
func (mux *Groups) Get(path string, handlerFunc HandlerFunc, middleName ...string)
handFunc
func (*Groups) Head ¶ added in v1.1.0
func (mux *Groups) Head(path string, handlerFunc HandlerFunc, middleName ...string)
func (*Groups) Middleware ¶
func (*Groups) Options ¶ added in v1.1.0
func (mux *Groups) Options(path string, handlerFunc HandlerFunc, middleName ...string)
func (*Groups) Patch ¶ added in v1.1.0
func (mux *Groups) Patch(path string, handlerFunc HandlerFunc, middleName ...string)
func (*Groups) Post ¶
func (mux *Groups) Post(path string, handlerFunc HandlerFunc, middleName ...string)
type HandlerFunc ¶
type HandlerFunc func(http.ResponseWriter, *http.Request, *Core)
type Plugin ¶
type Plugin struct { }
要求有自动注册插件到Core中去 插件名字 插件结构体 插件应该要继承 Core 结构体 并且重写 AutoStart 和 AutoBefore 方法 插件执行时间 应该分为2个阶段 一个是 系统启动 一个是 执行HandlerFunc之前
func (*Plugin) AutoBefore ¶
func (pl *Plugin)AutoStart() interface{} { return nil }
type Trie ¶
type Trie struct {
// contains filtered or unexported fields
}
func (*Trie) AutoRegister ¶
func (mux *Trie) AutoRegister(auto interface{}) *AutoRegister
func (*Trie) Connect ¶
func (mux *Trie) Connect(path string, handlerFunc HandlerFunc, middleName ...string)
func (*Trie) Delete ¶
func (mux *Trie) Delete(path string, handlerFunc HandlerFunc, middleName ...string)
func (*Trie) GlobalFunc ¶
func (*Trie) Head ¶
func (mux *Trie) Head(path string, handlerFunc HandlerFunc, middleName ...string)
func (*Trie) HttpProxy ¶ added in v1.1.0
func (mux *Trie) HttpProxy(dr *DynamicRoute) func(w http.ResponseWriter, r *http.Request, core *Core)
func (*Trie) Middleware ¶
func (*Trie) Options ¶
func (mux *Trie) Options(path string, handlerFunc HandlerFunc, middleName ...string)
func (*Trie) Patch ¶
func (mux *Trie) Patch(path string, handlerFunc HandlerFunc, middleName ...string)
func (*Trie) Post ¶
func (mux *Trie) Post(path string, handlerFunc HandlerFunc, middleName ...string)
func (*Trie) SetEncryption ¶ added in v1.3.0
func (mux *Trie) SetEncryption(e Encryption)
func (*Trie) StopSession ¶
func (mux *Trie) StopSession()
Click to show internal directories.
Click to hide internal directories.