Documentation ¶
Index ¶
- Constants
- func ErrRecover(w http.ResponseWriter)
- func View(fullPath, relative string, static embed.FS, rew http.ResponseWriter, ...)
- 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 Context
- type ControlInfo
- type CorsHandle
- type Default
- type Interceptor
- type MultipartFile
- type Recover
- type Response
- type Variate
- type Verify
- type ViewHandle
Constants ¶
View Source
const ( AuroraMultipartFile = "AuroraMultipartFile" //文件解析 AuroraRequest = "AuroraRequest" //go 原生请求 AuroraResponse = "AuroraResponse" //go 原生响应 AuroraValues = "AuroraValues" HttpStatus = "httpStatus20230516" )
View Source
const ( AccessControlAllowOrigin = "Access-Control-Allow-Origin" AccessControlAllowMethods = "Access-Control-Allow-Methods" AccessControlAllowHeaders = "Access-Control-Allow-Headers" AccessControlExposeHeaders = "Access-Control-Expose-Headers" AccessControlAllowCredentials = "Access-Control-Allow-Credentials" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
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() any
Constructor 用于加载 匿名组件的构造器类型 Aurora 会执行这个函数 并把得到的变量加载到容器中
type Context ¶
type Context map[string]interface{}
Context 上下文参数,主要用于在业务之间传递 数据使用 上下文参数中获取请求参数需要依赖于传递的参数名称 Ctx 不是线程安全的,在请求中出现多线程操作需要使用锁来保证安全性
func (Context) MultipartFile ¶
func (ctx Context) MultipartFile() *MultipartFile
MultipartFile 获取POST文件上传
func (Context) Response ¶
func (ctx Context) Response() http.ResponseWriter
Response 返回元素 ResponseWriter
type ControlInfo ¶
type ControlInfo struct { Path string Control any Interceptor []Interceptor }
ControlInfo 用于存储在服务器启动之前注册的接口信息,需要在加载完配置项之后进行统一注册
type CorsHandle ¶
type CorsHandle func(r *http.Request, w http.ResponseWriter) bool
CorsHandle 跨域处理器
type Default ¶
type Default struct { Method map[string][]string //运行跨域的 HTTP请求类型 Host map[string][]string //允许跨域的主机 AllowOrigin []string AllowMethods []string AllowHeaders []string AllowCredentials []string ExposeHeaders []string // contains filtered or unexported fields }
func NewDefaultCors ¶
func NewDefaultCors() *Default
type Interceptor ¶
type Interceptor interface { Before(ctx Context, handler any) (bool, error) Complete(ctx Context, handler any) error After(ctx Context, handler any) error }
Interceptor 拦截器
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 ViewHandle ¶
ViewHandle 是整个服务器对视图渲染的核心函数,开发者实现改接口对需要展示的页面进行自定义处理
Click to show internal directories.
Click to hide internal directories.