Documentation
¶
Index ¶
- type Apper
- func (this *Apper) Close()
- func (this *Apper) Get(path string, f http.HandlerFunc, mid ...MiddlewareFunc)
- func (this *Apper) GetClientIP(r *http.Request) string
- func (this *Apper) Logger()
- func (this *Apper) Post(path string, f http.HandlerFunc, mid ...MiddlewareFunc)
- func (this *Apper) Route(method string, path string, f http.HandlerFunc, mid ...MiddlewareFunc)
- func (this *Apper) Run()
- func (this *Apper) RunTLS(certFile, keyFile string)
- func (this *Apper) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (this *Apper) SetCache()
- func (this *Apper) SetConfig()
- func (this *Apper) SetLimit()
- func (this *Apper) SetLog()
- func (this *Apper) SetPort()
- func (this *Apper) Use(middleware ...MiddlewareFunc)
- type Cacher
- type Configer
- type FileUploader
- type Jwter
- func (this *Jwter) Decode(token string) (string, error)
- func (this *Jwter) Encode() (string, error)
- func (this *Jwter) GetArr(tokenstr string) ([]string, error)
- func (this *Jwter) GetJoin(key string, exp string, code string) (string, error)
- func (this *Jwter) OneToTwo(val string) string
- func (this *Jwter) Validate(token string) error
- type MiddlewareFunc
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Apper ¶
type Apper struct {
// 緩存器
Cache *Cacher
// contains filtered or unexported fields
}
Apper 是应用程序的主结构体,包含路由映射、配置信息、端口、日志等信息
func (*Apper) Get ¶
func (this *Apper) Get(path string, f http.HandlerFunc, mid ...MiddlewareFunc)
Get 注册GET请求的路由处理函数
func (*Apper) GetClientIP ¶
GetClientIP 获取客户端真实IP地址
func (*Apper) Post ¶
func (this *Apper) Post(path string, f http.HandlerFunc, mid ...MiddlewareFunc)
Post 注册POST请求的路由处理函数
func (*Apper) Route ¶
func (this *Apper) Route(method string, path string, f http.HandlerFunc, mid ...MiddlewareFunc)
Route 注册指定HTTP方法的路由处理函数
type Cacher ¶
type Cacher struct {
// contains filtered or unexported fields
}
type FileUploader ¶
type FileUploader struct {
MaxSize int64
AllowedTypes []string
SavePath string
FieldName string // 添加单文件字段名
FieldNames string // 添加多文件字段名
Keyword string // 添加文件名关键字
}
func NewFileUploader ¶
func NewFileUploader(maxSize int64, allowedTypes []string, savePath string) *FileUploader
func (*FileUploader) HandleUpload ¶
func (f *FileUploader) HandleUpload(r *http.Request) ([]string, error)
HandleUpload 修改为支持批量文件上传
Click to show internal directories.
Click to hide internal directories.