Documentation
¶
Index ¶
- Constants
- func DumpRequest(req *http.Request) string
- func JSONMarshal(t interface{}) ([]byte, error)
- func Logger(ctx context.Context, response string, statuscode int)
- func Output(out *Data, level string)
- func ResponseJSON(w http.ResponseWriter, ctx context.Context, code int, status bool, ...)
- func ResponseXML(w http.ResponseWriter, ctx context.Context, code int, status bool, ...)
- func StartRecord(req *http.Request, start time.Time) *http.Request
- type Data
- type Group
- func (g *Group) Delete(path string, handler func(http.ResponseWriter, *http.Request))
- func (g *Group) Get(path string, handler func(http.ResponseWriter, *http.Request))
- func (g *Group) Patch(path string, handler func(http.ResponseWriter, *http.Request))
- func (g *Group) Post(path string, handler func(http.ResponseWriter, *http.Request))
- func (g *Group) Put(path string, handler func(http.ResponseWriter, *http.Request))
- type Key
- type Responseservice
- type Router
- func (r *Router) Delete(path string, handler func(http.ResponseWriter, *http.Request))
- func (r *Router) Get(path string, handler func(http.ResponseWriter, *http.Request))
- func (r *Router) Group(prefix string) *Group
- func (r *Router) Patch(path string, handler func(http.ResponseWriter, *http.Request))
- func (r *Router) Post(path string, handler func(http.ResponseWriter, *http.Request))
- func (r *Router) Put(path string, handler func(http.ResponseWriter, *http.Request))
- func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (r *Router) Use(middlewares ...func(http.Handler) http.Handler)
- type UTCFormatter
Constants ¶
View Source
const ( LogKey = Key(48) COMPLETE_LOGING = "FULLY_LOGGING" INCOMPLETE_LOGING = "INCOMPLETE_LOGING" NON_LOGING = "NON_LOGING" )
View Source
const HttpMethodDelete = "DELETE"
View Source
const HttpMethodGet = "GET"
View Source
const HttpMethodPatch = "PATCH"
View Source
const HttpMethodPost = "POST"
View Source
const HttpMethodPut = "PUT"
Variables ¶
This section is empty.
Functions ¶
func DumpRequest ¶
DumpRequest returns the http request as a string.
func JSONMarshal ¶
JSONMarshal marshals the given type without HTML escaping.
func ResponseJSON ¶
func ResponseXML ¶
Types ¶
type Data ¶
type Data struct {
RequestID string `json:"RequestID"`
TimeStart time.Time `json:"TimeStart"`
UserCode string `json:"UserCode"`
Device string `json:"Device"`
Host string `json:"Host"`
Endpoint string `json:"Endpoint"`
RequestMethod string `json:"RequestMethod"`
RequestHeader string `json:"RequestHeader"`
StatusCode int `json:"StatusCode"`
Response string `json:"Response"`
ExecTime float64 `json:"ExecutionTime"`
Messages []string `json:"Messages"`
}
Data is data standard output
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group represents a collection of routes sharing the same prefix.
type Responseservice ¶
type Router ¶
type Router struct {
Routes map[string]map[string]func(http.ResponseWriter, *http.Request)
SettingLogs string
// contains filtered or unexported fields
}
Router is a tiny HTTP request router with grouping and middleware support.
func SetupDefaultRouter ¶
func SetupDefaultRouter() *Router
SetupDefaultRouter returns router with logging enabled.
func SetupWithNoLogging ¶
func SetupWithNoLogging() *Router
SetupWithNoLogging returns router without logging.
Click to show internal directories.
Click to hide internal directories.