// Code generated by qtc from "metrics_expand_response.qtpl". DO NOT EDIT.
// See https://github.com/valyala/quicktemplate for details.

// MetricsExpandResponseByQuery generates response for /metrics/expand?groupByExpr=1 .See https://graphite-api.readthedocs.io/en/latest/api.html#metrics-expand

//line app/vmselect/graphite/metrics_expand_response.qtpl:5
package graphite

//line app/vmselect/graphite/metrics_expand_response.qtpl:5
import (
	qtio422016 "io"

	qt422016 "github.com/valyala/quicktemplate"
)

//line app/vmselect/graphite/metrics_expand_response.qtpl:5
var (
	_ = qtio422016.Copy
	_ = qt422016.AcquireByteBuffer
)

//line app/vmselect/graphite/metrics_expand_response.qtpl:5
func StreamMetricsExpandResponseByQuery(qw422016 *qt422016.Writer, m map[string][]string, jsonp string) {
//line app/vmselect/graphite/metrics_expand_response.qtpl:6
	if jsonp != "" {
//line app/vmselect/graphite/metrics_expand_response.qtpl:6
		qw422016.N().S(jsonp)
//line app/vmselect/graphite/metrics_expand_response.qtpl:6
		qw422016.N().S(`(`)
//line app/vmselect/graphite/metrics_expand_response.qtpl:6
	}
//line app/vmselect/graphite/metrics_expand_response.qtpl:6
	qw422016.N().S(`{"results":{`)
//line app/vmselect/graphite/metrics_expand_response.qtpl:9
	i := 0

//line app/vmselect/graphite/metrics_expand_response.qtpl:10
	for query, paths := range m {
//line app/vmselect/graphite/metrics_expand_response.qtpl:11
		qw422016.N().Q(query)
//line app/vmselect/graphite/metrics_expand_response.qtpl:11
		qw422016.N().S(`:`)
//line app/vmselect/graphite/metrics_expand_response.qtpl:11
		streammetricPaths(qw422016, paths)
//line app/vmselect/graphite/metrics_expand_response.qtpl:12
		i++

//line app/vmselect/graphite/metrics_expand_response.qtpl:13
		if i < len(m) {
//line app/vmselect/graphite/metrics_expand_response.qtpl:13
			qw422016.N().S(`,`)
//line app/vmselect/graphite/metrics_expand_response.qtpl:13
		}
//line app/vmselect/graphite/metrics_expand_response.qtpl:14
	}
//line app/vmselect/graphite/metrics_expand_response.qtpl:14
	qw422016.N().S(`}}`)
//line app/vmselect/graphite/metrics_expand_response.qtpl:17
	if jsonp != "" {
//line app/vmselect/graphite/metrics_expand_response.qtpl:17
		qw422016.N().S(`)`)
//line app/vmselect/graphite/metrics_expand_response.qtpl:17
	}
//line app/vmselect/graphite/metrics_expand_response.qtpl:18
}

//line app/vmselect/graphite/metrics_expand_response.qtpl:18
func WriteMetricsExpandResponseByQuery(qq422016 qtio422016.Writer, m map[string][]string, jsonp string) {
//line app/vmselect/graphite/metrics_expand_response.qtpl:18
	qw422016 := qt422016.AcquireWriter(qq422016)
//line app/vmselect/graphite/metrics_expand_response.qtpl:18
	StreamMetricsExpandResponseByQuery(qw422016, m, jsonp)
//line app/vmselect/graphite/metrics_expand_response.qtpl:18
	qt422016.ReleaseWriter(qw422016)
//line app/vmselect/graphite/metrics_expand_response.qtpl:18
}

//line app/vmselect/graphite/metrics_expand_response.qtpl:18
func MetricsExpandResponseByQuery(m map[string][]string, jsonp string) string {
//line app/vmselect/graphite/metrics_expand_response.qtpl:18
	qb422016 := qt422016.AcquireByteBuffer()
//line app/vmselect/graphite/metrics_expand_response.qtpl:18
	WriteMetricsExpandResponseByQuery(qb422016, m, jsonp)
//line app/vmselect/graphite/metrics_expand_response.qtpl:18
	qs422016 := string(qb422016.B)
//line app/vmselect/graphite/metrics_expand_response.qtpl:18
	qt422016.ReleaseByteBuffer(qb422016)
//line app/vmselect/graphite/metrics_expand_response.qtpl:18
	return qs422016
//line app/vmselect/graphite/metrics_expand_response.qtpl:18
}

// MetricsExpandResponseFlat generates response for /metrics/expand?groupByExpr=0 .See https://graphite-api.readthedocs.io/en/latest/api.html#metrics-expand

//line app/vmselect/graphite/metrics_expand_response.qtpl:23
func StreamMetricsExpandResponseFlat(qw422016 *qt422016.Writer, paths []string, jsonp string) {
//line app/vmselect/graphite/metrics_expand_response.qtpl:24
	if jsonp != "" {
//line app/vmselect/graphite/metrics_expand_response.qtpl:24
		qw422016.N().S(jsonp)
//line app/vmselect/graphite/metrics_expand_response.qtpl:24
		qw422016.N().S(`(`)
//line app/vmselect/graphite/metrics_expand_response.qtpl:24
	}
//line app/vmselect/graphite/metrics_expand_response.qtpl:25
	streammetricPaths(qw422016, paths)
//line app/vmselect/graphite/metrics_expand_response.qtpl:26
	if jsonp != "" {
//line app/vmselect/graphite/metrics_expand_response.qtpl:26
		qw422016.N().S(`)`)
//line app/vmselect/graphite/metrics_expand_response.qtpl:26
	}
//line app/vmselect/graphite/metrics_expand_response.qtpl:27
}

//line app/vmselect/graphite/metrics_expand_response.qtpl:27
func WriteMetricsExpandResponseFlat(qq422016 qtio422016.Writer, paths []string, jsonp string) {
//line app/vmselect/graphite/metrics_expand_response.qtpl:27
	qw422016 := qt422016.AcquireWriter(qq422016)
//line app/vmselect/graphite/metrics_expand_response.qtpl:27
	StreamMetricsExpandResponseFlat(qw422016, paths, jsonp)
//line app/vmselect/graphite/metrics_expand_response.qtpl:27
	qt422016.ReleaseWriter(qw422016)
//line app/vmselect/graphite/metrics_expand_response.qtpl:27
}

//line app/vmselect/graphite/metrics_expand_response.qtpl:27
func MetricsExpandResponseFlat(paths []string, jsonp string) string {
//line app/vmselect/graphite/metrics_expand_response.qtpl:27
	qb422016 := qt422016.AcquireByteBuffer()
//line app/vmselect/graphite/metrics_expand_response.qtpl:27
	WriteMetricsExpandResponseFlat(qb422016, paths, jsonp)
//line app/vmselect/graphite/metrics_expand_response.qtpl:27
	qs422016 := string(qb422016.B)
//line app/vmselect/graphite/metrics_expand_response.qtpl:27
	qt422016.ReleaseByteBuffer(qb422016)
//line app/vmselect/graphite/metrics_expand_response.qtpl:27
	return qs422016
//line app/vmselect/graphite/metrics_expand_response.qtpl:27
}

//line app/vmselect/graphite/metrics_expand_response.qtpl:29
func streammetricPaths(qw422016 *qt422016.Writer, paths []string) {
//line app/vmselect/graphite/metrics_expand_response.qtpl:29
	qw422016.N().S(`[`)
//line app/vmselect/graphite/metrics_expand_response.qtpl:31
	for i, path := range paths {
//line app/vmselect/graphite/metrics_expand_response.qtpl:32
		qw422016.N().Q(path)
//line app/vmselect/graphite/metrics_expand_response.qtpl:33
		if i+1 < len(paths) {
//line app/vmselect/graphite/metrics_expand_response.qtpl:33
			qw422016.N().S(`,`)
//line app/vmselect/graphite/metrics_expand_response.qtpl:33
		}
//line app/vmselect/graphite/metrics_expand_response.qtpl:34
	}
//line app/vmselect/graphite/metrics_expand_response.qtpl:34
	qw422016.N().S(`]`)
//line app/vmselect/graphite/metrics_expand_response.qtpl:36
}

//line app/vmselect/graphite/metrics_expand_response.qtpl:36
func writemetricPaths(qq422016 qtio422016.Writer, paths []string) {
//line app/vmselect/graphite/metrics_expand_response.qtpl:36
	qw422016 := qt422016.AcquireWriter(qq422016)
//line app/vmselect/graphite/metrics_expand_response.qtpl:36
	streammetricPaths(qw422016, paths)
//line app/vmselect/graphite/metrics_expand_response.qtpl:36
	qt422016.ReleaseWriter(qw422016)
//line app/vmselect/graphite/metrics_expand_response.qtpl:36
}

//line app/vmselect/graphite/metrics_expand_response.qtpl:36
func metricPaths(paths []string) string {
//line app/vmselect/graphite/metrics_expand_response.qtpl:36
	qb422016 := qt422016.AcquireByteBuffer()
//line app/vmselect/graphite/metrics_expand_response.qtpl:36
	writemetricPaths(qb422016, paths)
//line app/vmselect/graphite/metrics_expand_response.qtpl:36
	qs422016 := string(qb422016.B)
//line app/vmselect/graphite/metrics_expand_response.qtpl:36
	qt422016.ReleaseByteBuffer(qb422016)
//line app/vmselect/graphite/metrics_expand_response.qtpl:36
	return qs422016
//line app/vmselect/graphite/metrics_expand_response.qtpl:36
}
