Documentation ¶
Index ¶
Constants ¶
View Source
const CSVContentType = "text/csv"
View Source
const JSONContentType = "application/json"
Variables ¶
View Source
var ( ErrorInternalServer = NewError("Internal Server Error", http.StatusInternalServerError) ErrorForbiddenResource = NewError("Forbidden Resource", http.StatusForbidden) ErrorBadRequest = NewError("Bad Request", http.StatusBadRequest) )
Functions ¶
This section is empty.
Types ¶
type BasicResponse ¶
func (*BasicResponse) WriteResponse ¶
func (b *BasicResponse) WriteResponse(w http.ResponseWriter)
type CSVResponse ¶
type CSVResponse struct { BasicResponse CSVBody CSVBody Error error }
func NewCSVResponse ¶
func NewCSVResponse() *CSVResponse
func (*CSVResponse) SetData ¶
func (r *CSVResponse) SetData(data []byte) *CSVResponse
func (*CSVResponse) SetName ¶
func (r *CSVResponse) SetName(name string) *CSVResponse
func (*CSVResponse) WriteResponse ¶
func (r *CSVResponse) WriteResponse(w http.ResponseWriter)
type Error ¶
type HTTPResponse ¶
type HTTPResponse interface {
WriteResponse(w http.ResponseWriter)
}
type JSONResponse ¶
type JSONResponse struct { BasicResponse JSONBody JSONBody Error error }
func NewJSONResponse ¶
func NewJSONResponse() *JSONResponse
func (*JSONResponse) SetData ¶
func (r *JSONResponse) SetData(data interface{}) *JSONResponse
func (*JSONResponse) SetError ¶
func (r *JSONResponse) SetError(err error) *JSONResponse
func (*JSONResponse) SetMessage ¶
func (r *JSONResponse) SetMessage(message string) *JSONResponse
func (*JSONResponse) WriteResponse ¶
func (r *JSONResponse) WriteResponse(w http.ResponseWriter)
Click to show internal directories.
Click to hide internal directories.