github.com/Bio-core/jtree@v0.0.0-20190705165106-1d7a7e7d6272/restapi/operations/get_sample_columns.go (about) 1 package operations 2 3 // This file was generated by the swagger tool. 4 // Editing this file might prove futile when you re-run the generate command 5 6 import ( 7 "net/http" 8 9 middleware "github.com/go-openapi/runtime/middleware" 10 ) 11 12 // GetSampleColumnsHandlerFunc turns a function with the right signature into a get sample columns handler 13 type GetSampleColumnsHandlerFunc func(GetSampleColumnsParams) middleware.Responder 14 15 // Handle executing the request and returning a response 16 func (fn GetSampleColumnsHandlerFunc) Handle(params GetSampleColumnsParams) middleware.Responder { 17 return fn(params) 18 } 19 20 // GetSampleColumnsHandler interface for that can handle valid get sample columns params 21 type GetSampleColumnsHandler interface { 22 Handle(GetSampleColumnsParams) middleware.Responder 23 } 24 25 // NewGetSampleColumns creates a new http.Handler for the get sample columns operation 26 func NewGetSampleColumns(ctx *middleware.Context, handler GetSampleColumnsHandler) *GetSampleColumns { 27 return &GetSampleColumns{Context: ctx, Handler: handler} 28 } 29 30 /*GetSampleColumns swagger:route GET /columns getSampleColumns 31 32 gets columns 33 34 gets column names 35 36 */ 37 type GetSampleColumns struct { 38 Context *middleware.Context 39 Handler GetSampleColumnsHandler 40 } 41 42 func (o *GetSampleColumns) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 43 rw.Header().Set("Access-Control-Allow-Origin", "*") 44 route, rCtx, _ := o.Context.RouteInfo(r) 45 if rCtx != nil { 46 r = rCtx 47 } 48 var Params = NewGetSampleColumnsParams() 49 50 if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 51 o.Context.Respond(rw, r, route.Produces, route, err) 52 return 53 } 54 55 res := o.Handler.Handle(Params) // actually handle the request 56 57 o.Context.Respond(rw, r, route.Produces, route, res) 58 59 }