# epackage **Repository Path**: JesusSlim/epackage ## Basic Information - **Project Name**: epackage - **Description**: 为了更方便地使用,提供一些golang的简单封装. - **Primary Language**: Go - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2016-07-21 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # epackage Epackage provided some encapsulation of golang.为了更方便地使用,提供一些golang的简单封装. ## Request Request.go提供针对http.request的一些封装 使得使用更为简便 并规避了一些post取参数的坑 ### Get it: go get -u github.com/jesusslim/epackage ### Use it: //in your ServeHTTP,req is the param name of *http.Request mr := epackage.Request(req) fmt.Println("get:", mr.GetFloat("sid")) fmt.Println("cookie:", mr.GetCookie("test")) fmt.Println("stash", mr.Stash("sid")) fmt.Println("stash set", mr.Stash("sid", 123)) fmt.Println("stash get", mr.Stash("sid")) if mr.IsGet() { //... } ### Functions: IsGet:the method of request is get or not IsPost:the method of request is post or not IsAjax:the method of request is post or not IsWebsocket:is an websocket request or not Params:return the params in request GetString:return an string param by key,if it's nil,return the default value GetInt:return an int param by key,if it's nil,return the default value GetInt64:return an int64 param by key,if it's nil,return the default value GetFloat:return an float64 param by key,if it's nil,return the default value ParseFormAuto:parse form by func ParseMultipartForm or ParseForm GetCookie:return an string value by key in cookie,if it's nil,return the default value Stash:stash a k-v:Stash(k,v);get a value by key in stash:Stash(k)