Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplicationProperties ¶
type ApplicationProperties struct { DSN string //数据库连接串 MongoURL string //mongodb 连接串 MongoDatabase string //mongodb 数据库 RedisURL string //redis 连接串 BindAdreess string //restful url FileBaseDir string //文件存储基础位置 FileMaxSize int //文件最大大小 OAuthClientID string //github OAuth 的client ID OAuthClientSecret string //github OAuth 的client secret }
ApplicationProperties 全局配置字符串
type CORSRouterDecorator ¶
CORSRouterDecorator applies CORS headers to a mux.Router
func (*CORSRouterDecorator) ServeHTTP ¶
func (c *CORSRouterDecorator) ServeHTTP(rw http.ResponseWriter, req *http.Request)
使用装饰者模式解决CORS问题 ServeHTTP wraps the HTTP server enabling CORS headers. For more info about CORS, visit https://www.w3.org/TR/cors/
type Configs ¶
type Configs struct { ApplicationProperties // contains filtered or unexported fields }
Configs 所有配置
func (*Configs) RegisterService ¶
RegisterService 注册配置
func (*Configs) RegisterServices ¶
func (c *Configs) RegisterServices()
RegisterServices 注册所有服务 扩展的服务需要写在这
type Connection ¶
type Connection struct { DB *sqlx.DB // sqlx DB MongoDB *mongo.Database // mongo DB Redis *redis.Client // redis DB // contains filtered or unexported fields }
Connection 数据库连接
type HTTPRequestHandler ¶
type HTTPRequestHandler interface {
GetRoutes() []*Route
}
HTTPRequestHandler http请求的handler
type Route ¶
type Route struct { Method string //方法类型 Path string //路由路径 Handler http.HandlerFunc //处理器 MiddlewareFuncs []mux.MiddlewareFunc //中间件 }
Route 路由 wrapper
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router 小小路由封装
func (*Router) AddHTTPRequestHanlder ¶
func (r *Router) AddHTTPRequestHanlder(hanlder HTTPRequestHandler) *Router
AddHTTPRequestHanlder 添加
Click to show internal directories.
Click to hide internal directories.