Documentation ¶
Index ¶
- func Run(app Application) error
- func Use(app Application, components ...Component)
- type Application
- type ArgsAnalysisError
- type Aurora
- func (a *Aurora) Catch(err Error)
- func (a *Aurora) Delete(url string, control Controller, middleware ...Middleware)
- func (a *Aurora) Get(url string, control Controller, middleware ...Middleware)
- func (a *Aurora) GetConfig() Config
- func (a *Aurora) Group(url string, middleware ...Middleware) *Group
- func (a *Aurora) Head(url string, control Controller, middleware ...Middleware)
- func (a *Aurora) Post(url string, control Controller, middleware ...Middleware)
- func (a *Aurora) Put(url string, control Controller, middleware ...Middleware)
- func (a *Aurora) Run() error
- func (a *Aurora) ServeHTTP(rw http.ResponseWriter, req *http.Request)
- func (a *Aurora) Url(url string, control Controller, middleware ...Middleware)
- func (a *Aurora) Use(Configuration ...interface{})
- type Component
- type Config
- type ConfigCenter
- func (c *ConfigCenter) Get(key string) interface{}
- func (c *ConfigCenter) GetString(key string) string
- func (c *ConfigCenter) GetStringMap(key string) map[string]interface{}
- func (c *ConfigCenter) GetStringMapString(key string) map[string]string
- func (c *ConfigCenter) GetStringMapStringSlice(key string) map[string][]string
- func (c *ConfigCenter) GetStringSlice(key string) []string
- func (c *ConfigCenter) ReadConfig(in io.Reader) error
- func (c *ConfigCenter) ReadInConfig() error
- func (c *ConfigCenter) Set(key string, value interface{})
- func (c *ConfigCenter) SetConfigFile(in string)
- func (c *ConfigCenter) SetConfigType(in string)
- func (c *ConfigCenter) SetDefault(key string, value interface{})
- type ContentType
- type Controller
- type Ctx
- func (c Ctx) AddHeader(name, value string)
- func (c Ctx) Clear()
- func (c Ctx) DelHeader(name string)
- func (c Ctx) FormFile(name string) (*multipart.FileHeader, error)
- func (c Ctx) GetHeader(name string) string
- func (c Ctx) GetPostFormArray(key string) ([]string, bool)
- func (c Ctx) GetPostFormMap(key string) (map[string]string, bool)
- func (c Ctx) GetQuery(key string) (string, bool)
- func (c Ctx) GetQueryArray(key string) ([]string, bool)
- func (c Ctx) GetQueryMap(key string) (map[string]string, bool)
- func (c Ctx) MultipartForm() (*multipart.Form, error)
- func (c Ctx) PostFormMap(key string) map[string]string
- func (c Ctx) Query(key string) string
- func (c Ctx) QueryMap(key string) map[string]string
- func (c Ctx) Ref(ref string) interface{}
- func (c Ctx) Request() *http.Request
- func (c Ctx) Response() http.ResponseWriter
- func (c Ctx) Return(value ...interface{})
- func (c Ctx) SetCookie(name, value string, maxAge int, path, domain string, secure, httpOnly bool)
- type Error
- type ErrorResponse
- type Formatter
- type Group
- func (g *Group) Delete(url string, control Controller, middleware ...Middleware)
- func (g *Group) Get(url string, control Controller, middleware ...Middleware)
- func (g *Group) Group(url string, middleware ...Middleware) *Group
- func (g *Group) Head(url string, control Controller, middleware ...Middleware)
- func (g *Group) Post(url string, control Controller, middleware ...Middleware)
- func (g *Group) Put(url string, control Controller, middleware ...Middleware)
- func (g *Group) Url(url string, control Controller, middleware ...Middleware)
- func (g *Group) Use(middleware ...Middleware)
- type Log
- type Middleware
- type MultipartFile
- type Option
- type UseConfiguration
- type UseOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶ added in v0.3.8
func Run(app Application) error
func Use ¶
func Use(app Application, components ...Component)
Use 提供一个全局的注册器,把参数 components 加载到 Aurora实例中
Types ¶
type Application ¶ added in v0.3.8
type Application interface { Use(...interface{}) Run() error }
type ArgsAnalysisError ¶ added in v0.3.1
type ArgsAnalysisError struct {
// contains filtered or unexported fields
}
ArgsAnalysisError 参数解析错误
func (ArgsAnalysisError) Error ¶ added in v0.3.1
func (a ArgsAnalysisError) Error() string
type Aurora ¶
type Aurora struct { // 日志 Log // 文件上传大小配置 MaxMultipartMemory int64 // contains filtered or unexported fields }
func (*Aurora) Delete ¶ added in v0.3.1
func (a *Aurora) Delete(url string, control Controller, middleware ...Middleware)
Delete 请求
func (*Aurora) Get ¶ added in v0.3.1
func (a *Aurora) Get(url string, control Controller, middleware ...Middleware)
Get 请求
func (*Aurora) Group ¶
func (a *Aurora) Group(url string, middleware ...Middleware) *Group
Group 路由分组 必须以 “/” 开头分组 Group 和 Aurora 都有 相同的 http 方法注册
func (*Aurora) Head ¶ added in v0.3.1
func (a *Aurora) Head(url string, control Controller, middleware ...Middleware)
Head 请求
func (*Aurora) Post ¶ added in v0.3.1
func (a *Aurora) Post(url string, control Controller, middleware ...Middleware)
Post 请求
func (*Aurora) Put ¶ added in v0.3.1
func (a *Aurora) Put(url string, control Controller, middleware ...Middleware)
Put 请求
func (*Aurora) ServeHTTP ¶
func (a *Aurora) ServeHTTP(rw http.ResponseWriter, req *http.Request)
ServeHTTP 一切的开始
func (*Aurora) Url ¶ added in v0.4.8
func (a *Aurora) Url(url string, control Controller, middleware ...Middleware)
Url 结构体专属 注册器
type Config ¶ added in v0.4.9
type Config interface { SetConfigFile(string) SetConfigType(string) ReadConfig(io.Reader) error Set(string, interface{}) SetDefault(string, interface{}) GetStringMapString(string) map[string]string Get(string) interface{} GetStringSlice(string) []string GetStringMap(string) map[string]interface{} GetString(string) string GetStringMapStringSlice(string) map[string][]string }
type ConfigCenter ¶
ConfigCenter 配置中心 的读写锁主要用来解决分布式配置的动态刷新配置,和以后存在的并发读取配置和修改, 对于修改配置数据库连接信息或者需要重新初始化的配置项这些无法起到同步更新的效果只能保持配置信息是最新的(需要重新初始化的配置建议重启服务), 对被配置的使用实例没有并发安全的效果。
func (*ConfigCenter) Get ¶
func (c *ConfigCenter) Get(key string) interface{}
func (*ConfigCenter) GetString ¶
func (c *ConfigCenter) GetString(key string) string
func (*ConfigCenter) GetStringMap ¶
func (c *ConfigCenter) GetStringMap(key string) map[string]interface{}
func (*ConfigCenter) GetStringMapString ¶
func (c *ConfigCenter) GetStringMapString(key string) map[string]string
func (*ConfigCenter) GetStringMapStringSlice ¶
func (c *ConfigCenter) GetStringMapStringSlice(key string) map[string][]string
func (*ConfigCenter) GetStringSlice ¶
func (c *ConfigCenter) GetStringSlice(key string) []string
func (*ConfigCenter) ReadConfig ¶
func (c *ConfigCenter) ReadConfig(in io.Reader) error
func (*ConfigCenter) ReadInConfig ¶
func (c *ConfigCenter) ReadInConfig() error
func (*ConfigCenter) Set ¶ added in v0.3.9
func (c *ConfigCenter) Set(key string, value interface{})
func (*ConfigCenter) SetConfigFile ¶
func (c *ConfigCenter) SetConfigFile(in string)
func (*ConfigCenter) SetConfigType ¶
func (c *ConfigCenter) SetConfigType(in string)
func (*ConfigCenter) SetDefault ¶ added in v0.3.9
func (c *ConfigCenter) SetDefault(key string, value interface{})
type Controller ¶ added in v0.3.1
type Controller = interface{}
type Ctx ¶ added in v0.3.1
type Ctx map[string]interface{}
Ctx 上下文参数,主要用于在业务之间传递 数据使用 上下文参数中获取请求参数需要依赖于传递的参数名称 Ctx 不是线程安全的,在请求中出现多线程操作需要使用锁来保证安全性
func (Ctx) FormFile ¶ added in v0.3.9
func (c Ctx) FormFile(name string) (*multipart.FileHeader, error)
FormFile 获取文件
func (Ctx) GetPostFormArray ¶ added in v0.3.9
func (Ctx) GetPostFormMap ¶ added in v0.3.9
func (Ctx) GetQueryMap ¶ added in v0.3.9
func (Ctx) Response ¶ added in v0.3.1
func (c Ctx) Response() http.ResponseWriter
Response 返回元素 ResponseWriter
type ErrorResponse ¶
type Formatter ¶ added in v0.4.9
type Formatter struct {
*logrus.TextFormatter
}
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
group 路由分组 初始化的 分组变量不会携带全局的Use group 可以设定局部的全局Use
func (*Group) Delete ¶ added in v0.4.1
func (g *Group) Delete(url string, control Controller, middleware ...Middleware)
Delete 请求
func (*Group) Get ¶ added in v0.4.1
func (g *Group) Get(url string, control Controller, middleware ...Middleware)
Get 请求
func (*Group) Group ¶ added in v0.4.1
func (g *Group) Group(url string, middleware ...Middleware) *Group
Group 路由分组 必须以 “/” 开头分组
func (*Group) Head ¶ added in v0.4.1
func (g *Group) Head(url string, control Controller, middleware ...Middleware)
Head 请求
func (*Group) Post ¶ added in v0.4.1
func (g *Group) Post(url string, control Controller, middleware ...Middleware)
Post 请求
func (*Group) Put ¶ added in v0.4.1
func (g *Group) Put(url string, control Controller, middleware ...Middleware)
Put 请求
func (*Group) Url ¶ added in v0.4.9
func (g *Group) Url(url string, control Controller, middleware ...Middleware)
func (*Group) Use ¶ added in v0.4.1
func (g *Group) Use(middleware ...Middleware)
Use 基于 group 的分组添加 Middleware
type Log ¶ added in v0.3.8
type Log interface { Info(...interface{}) Error(...interface{}) Debug(...interface{}) Panic(...interface{}) Warn(...interface{}) }
Log 自定义Log需要实现的借口
type MultipartFile ¶ added in v0.3.1
type MultipartFile struct {
File map[string][]*multipart.FileHeader
}
func (*MultipartFile) SaveUploadedFile ¶ added in v0.3.1
func (m *MultipartFile) SaveUploadedFile(file *multipart.FileHeader, dst string) error
SaveUploadedFile 保存文件
type Option ¶ added in v0.4.5
type Option func(*Aurora)
func ViperConfiguration ¶ added in v0.4.5
ViperConfiguration 配置指定配置文件
type UseConfiguration ¶ added in v0.3.9
type UseConfiguration func(interface{}) UseOption