package got import ( G "github.com/dave/jennifer/jen" ) var ( parser = "github.com/eugeniucarvalho/metric-query-parser/parser" GenMetricsStmts = &Middleware{ Id: "metrics", Type: "method", Fn: func(ctx *MiddlewareContext) error { ctx.Statement.Block(G.Id(` var ( metrics = `).Qual(parser, "MetricsMap").Values().Id(` errResolve error ) if err = api.ReadJson(ctx, &metrics); err != nil { return } if resp, errResolve = `).Qual(parser, "NewMetricQueryParser").Call().Id(`.Resolve(metrics); errResolve != nil { err = errs.Internal().Details(&errs.Detail{ Reason: "metricHandlerError", Message: errResolve.Error(), }) } return`)).Line() return nil }, } )