Documentation ¶
Index ¶
- Constants
- type Context
- func (bs *Context) AddHeader(header string, value string)
- func (bs *Context) ReadBodyParameter(name string) (string, error)
- func (bs *Context) ReadEntity(schema interface{}) (err error)
- func (bs *Context) ReadHeader(name string) string
- func (bs *Context) ReadPathParameter(name string) string
- func (bs *Context) ReadPathParameters() map[string]string
- func (bs *Context) ReadQueryParameter(name string) string
- func (bs *Context) ReadRequest() *http.Request
- func (bs *Context) ReadResponseWriter() http.ResponseWriter
- func (bs *Context) ReadRestfulRequest() *restful.Request
- func (bs *Context) ReadRestfulResponse() *restful.Response
- func (bs *Context) Write(body []byte)
- func (bs *Context) WriteError(httpStatus int, err error) error
- func (bs *Context) WriteHeader(httpStatus int)
- func (bs *Context) WriteHeaderAndJSON(status int, value interface{}, contentType string) error
- func (bs *Context) WriteJSON(value interface{}, contentType string) error
- type Route
Constants ¶
const ( //Name is a variable of type string which indicates the protocol being used Name = "rest" DefaultMetricPath = "metrics" MimeFile = "application/octet-stream" MimeMult = "multipart/form-data" )
constants for metric path and name
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context is a struct which has both request and response objects
func NewBaseServer ¶
NewBaseServer is a function which return context
func (*Context) ReadBodyParameter ¶
ReadBodyParameter used to read body parameter of a request
func (*Context) ReadEntity ¶
ReadEntity is request reader
func (*Context) ReadHeader ¶
ReadHeader is used to read header of request
func (*Context) ReadPathParameter ¶
ReadPathParameter is used to read path parameter of a request
func (*Context) ReadPathParameters ¶
ReadPathParameters used to read multiple path parameters of a request
func (*Context) ReadQueryParameter ¶
ReadQueryParameter is used to read query parameter of a request
func (*Context) ReadRequest ¶
ReadRequest return a native net/http request
func (*Context) ReadResponseWriter ¶
func (bs *Context) ReadResponseWriter() http.ResponseWriter
ReadResponseWriter return a native net/http ResponseWriter
func (*Context) ReadRestfulRequest ¶ added in v0.7.1
func (bs *Context) ReadRestfulRequest() *restful.Request
ReadRestfulRequest return a native go-restful request
func (*Context) ReadRestfulResponse ¶ added in v0.7.1
func (bs *Context) ReadRestfulResponse() *restful.Response
ReadRestfulResponse return a native go-restful Response
func (*Context) WriteError ¶
WriteError is a function used to write error into a response
func (*Context) WriteHeader ¶
WriteHeader is the response head writer
func (*Context) WriteHeaderAndJSON ¶
WriteHeaderAndJSON used to write head and JSON file in to response
type Route ¶
type Route struct { Method string // Method is one of the following: GET,PUT,POST,DELETE Path string // Path contains a path pattern ResourceFuncName string //Resource function name }
Route describe http route path and swagger specifications for API
func GetRouteSpecs ¶ added in v0.7.1
GetRouteSpecs is to return a rest API specification of a go struct