Documentation ¶
Index ¶
- func ErrorMsg(err error, msg ...string)
- func Run(app Application) error
- func Use(app Application, components ...Component)
- type Application
- 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{})
- func (c *ConfigCenter) WatchRemoteConfig() error
- type Constructor
- type Constructors
- type Controller
- type Ctx
- type Engine
- func (engine *Engine) Catch(err Error)
- func (engine *Engine) Delete(url string, control Controller, middleware ...Middleware)
- func (engine *Engine) Get(url string, control Controller, middleware ...Middleware)
- func (engine *Engine) GetConfig() Config
- func (engine *Engine) Group(url string, middleware ...Middleware) *Group
- func (engine *Engine) Head(url string, control Controller, middleware ...Middleware)
- func (engine *Engine) Post(url string, control Controller, middleware ...Middleware)
- func (engine *Engine) Put(url string, control Controller, middleware ...Middleware)
- func (engine *Engine) Root() string
- func (engine *Engine) ServeHTTP(rw http.ResponseWriter, req *http.Request)
- func (engine *Engine) SysVariable(v interface{}, constructor Constructor)
- func (engine *Engine) Use(Configuration ...interface{})
- type Error
- 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) Use(middleware ...Middleware)
- type Log
- type Middleware
- type MultipartFile
- type Option
- type Proxy
- type UseConfiguration
- type UseOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
func Run(app Application) error
func Use ¶
func Use(app Application, components ...Component)
Use 提供一个全局的注册器,把参数 components 加载到 YL实例中
Types ¶
type Application ¶
type Application interface { // Use 加载配置 Use(...interface{}) // Server 服务器初始化 // 依赖加载 等操作在这个函数中进行 Server() // Router 路由加载函数 Router() // contains filtered or unexported methods }
Application YL应用程序接口 通过继承YL 实例来完成web服务的构建
type Config ¶
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 ¶
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 ¶
func (c *ConfigCenter) SetDefault(key string, value interface{})
func (*ConfigCenter) WatchRemoteConfig ¶
func (c *ConfigCenter) WatchRemoteConfig() error
type Constructor ¶
type Constructor func(*Proxy) interface{}
type Constructors ¶
type Constructors func() interface{}
Constructors 用于加载 匿名组件的构造器类型 YL 会执行这个函数 并把得到的变量加载到 ioc 容器中
type Controller ¶
type Controller = interface{}
type Ctx ¶
type Ctx map[string]interface{}
Ctx 上下文参数,主要用于在业务之间传递 数据使用 上下文参数中获取请求参数需要依赖于传递的参数名称 Ctx 不是线程安全的,在请求中出现多线程操作需要使用锁来保证安全性
type Engine ¶
type Engine struct { // 日志 Log // 文件上传大小配置 MaxMultipartMemory int64 // contains filtered or unexported fields }
func (*Engine) Delete ¶
func (engine *Engine) Delete(url string, control Controller, middleware ...Middleware)
Delete 请求
func (*Engine) Get ¶
func (engine *Engine) Get(url string, control Controller, middleware ...Middleware)
Get 请求
func (*Engine) Group ¶
func (engine *Engine) Group(url string, middleware ...Middleware) *Group
Group 路由分组 必须以 “/” 开头分组 Group 和 YL 都有 相同的 http 方法注册
func (*Engine) Head ¶
func (engine *Engine) Head(url string, control Controller, middleware ...Middleware)
Head 请求
func (*Engine) Post ¶
func (engine *Engine) Post(url string, control Controller, middleware ...Middleware)
Post 请求
func (*Engine) Put ¶
func (engine *Engine) Put(url string, control Controller, middleware ...Middleware)
Put 请求
func (*Engine) ServeHTTP ¶
func (engine *Engine) ServeHTTP(rw http.ResponseWriter, req *http.Request)
ServeHTTP 一切的开始
func (*Engine) SysVariable ¶
func (engine *Engine) SysVariable(v interface{}, constructor Constructor)
type Formatter ¶
type Formatter struct {
*logrus.TextFormatter
}
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
func (*Group) Delete ¶
func (g *Group) Delete(url string, control Controller, middleware ...Middleware)
Delete 请求
func (*Group) Get ¶
func (g *Group) Get(url string, control Controller, middleware ...Middleware)
Get 请求
func (*Group) Group ¶
func (g *Group) Group(url string, middleware ...Middleware) *Group
Group 路由分组 必须以 “/” 开头分组
func (*Group) Head ¶
func (g *Group) Head(url string, control Controller, middleware ...Middleware)
Head 请求
func (*Group) Post ¶
func (g *Group) Post(url string, control Controller, middleware ...Middleware)
Post 请求
func (*Group) Put ¶
func (g *Group) Put(url string, control Controller, middleware ...Middleware)
Put 请求
type Log ¶
type Log interface { Info(...interface{}) Error(...interface{}) Debug(...interface{}) Panic(...interface{}) Warn(...interface{}) }
Log 自定义Log需要实现的借口
type MultipartFile ¶
type MultipartFile struct {
File map[string][]*multipart.FileHeader
}
func (*MultipartFile) SaveUploadedFile ¶
func (m *MultipartFile) SaveUploadedFile(file *multipart.FileHeader, dst string) error
SaveUploadedFile 保存文件
type Proxy ¶
type Proxy struct { *Engine Rew http.ResponseWriter Req *http.Request Ctx Ctx File *MultipartFile UrlVariable []string // contains filtered or unexported fields }
Proxy 主要完成 接口调用 和 处理响应
type UseConfiguration ¶
type UseConfiguration func(interface{}) UseOption
Source Files ¶
Click to show internal directories.
Click to hide internal directories.