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

//line app/vlselect/logsql/logsql.qtpl:1
package logsql

//line app/vlselect/logsql/logsql.qtpl:1
import (
	"github.com/VictoriaMetrics/VictoriaMetrics/lib/logstorage"
)

// ValuesWithHitsJSON generates JSON from the given values.

//line app/vlselect/logsql/logsql.qtpl:8
import (
	qtio422016 "io"

	qt422016 "github.com/valyala/quicktemplate"
)

//line app/vlselect/logsql/logsql.qtpl:8
var (
	_ = qtio422016.Copy
	_ = qt422016.AcquireByteBuffer
)

//line app/vlselect/logsql/logsql.qtpl:8
func StreamValuesWithHitsJSON(qw422016 *qt422016.Writer, values []logstorage.ValueWithHits) {
//line app/vlselect/logsql/logsql.qtpl:8
	qw422016.N().S(`{"values":`)
//line app/vlselect/logsql/logsql.qtpl:10
	streamvaluesWithHitsJSONArray(qw422016, values)
//line app/vlselect/logsql/logsql.qtpl:10
	qw422016.N().S(`}`)
//line app/vlselect/logsql/logsql.qtpl:12
}

//line app/vlselect/logsql/logsql.qtpl:12
func WriteValuesWithHitsJSON(qq422016 qtio422016.Writer, values []logstorage.ValueWithHits) {
//line app/vlselect/logsql/logsql.qtpl:12
	qw422016 := qt422016.AcquireWriter(qq422016)
//line app/vlselect/logsql/logsql.qtpl:12
	StreamValuesWithHitsJSON(qw422016, values)
//line app/vlselect/logsql/logsql.qtpl:12
	qt422016.ReleaseWriter(qw422016)
//line app/vlselect/logsql/logsql.qtpl:12
}

//line app/vlselect/logsql/logsql.qtpl:12
func ValuesWithHitsJSON(values []logstorage.ValueWithHits) string {
//line app/vlselect/logsql/logsql.qtpl:12
	qb422016 := qt422016.AcquireByteBuffer()
//line app/vlselect/logsql/logsql.qtpl:12
	WriteValuesWithHitsJSON(qb422016, values)
//line app/vlselect/logsql/logsql.qtpl:12
	qs422016 := string(qb422016.B)
//line app/vlselect/logsql/logsql.qtpl:12
	qt422016.ReleaseByteBuffer(qb422016)
//line app/vlselect/logsql/logsql.qtpl:12
	return qs422016
//line app/vlselect/logsql/logsql.qtpl:12
}

//line app/vlselect/logsql/logsql.qtpl:14
func streamvaluesWithHitsJSONArray(qw422016 *qt422016.Writer, values []logstorage.ValueWithHits) {
//line app/vlselect/logsql/logsql.qtpl:14
	qw422016.N().S(`[`)
//line app/vlselect/logsql/logsql.qtpl:16
	if len(values) > 0 {
//line app/vlselect/logsql/logsql.qtpl:17
		streamvalueWithHitsJSON(qw422016, values[0])
//line app/vlselect/logsql/logsql.qtpl:18
		for _, v := range values[1:] {
//line app/vlselect/logsql/logsql.qtpl:18
			qw422016.N().S(`,`)
//line app/vlselect/logsql/logsql.qtpl:19
			streamvalueWithHitsJSON(qw422016, v)
//line app/vlselect/logsql/logsql.qtpl:20
		}
//line app/vlselect/logsql/logsql.qtpl:21
	}
//line app/vlselect/logsql/logsql.qtpl:21
	qw422016.N().S(`]`)
//line app/vlselect/logsql/logsql.qtpl:23
}

//line app/vlselect/logsql/logsql.qtpl:23
func writevaluesWithHitsJSONArray(qq422016 qtio422016.Writer, values []logstorage.ValueWithHits) {
//line app/vlselect/logsql/logsql.qtpl:23
	qw422016 := qt422016.AcquireWriter(qq422016)
//line app/vlselect/logsql/logsql.qtpl:23
	streamvaluesWithHitsJSONArray(qw422016, values)
//line app/vlselect/logsql/logsql.qtpl:23
	qt422016.ReleaseWriter(qw422016)
//line app/vlselect/logsql/logsql.qtpl:23
}

//line app/vlselect/logsql/logsql.qtpl:23
func valuesWithHitsJSONArray(values []logstorage.ValueWithHits) string {
//line app/vlselect/logsql/logsql.qtpl:23
	qb422016 := qt422016.AcquireByteBuffer()
//line app/vlselect/logsql/logsql.qtpl:23
	writevaluesWithHitsJSONArray(qb422016, values)
//line app/vlselect/logsql/logsql.qtpl:23
	qs422016 := string(qb422016.B)
//line app/vlselect/logsql/logsql.qtpl:23
	qt422016.ReleaseByteBuffer(qb422016)
//line app/vlselect/logsql/logsql.qtpl:23
	return qs422016
//line app/vlselect/logsql/logsql.qtpl:23
}

//line app/vlselect/logsql/logsql.qtpl:25
func streamvalueWithHitsJSON(qw422016 *qt422016.Writer, v logstorage.ValueWithHits) {
//line app/vlselect/logsql/logsql.qtpl:25
	qw422016.N().S(`{"value":`)
//line app/vlselect/logsql/logsql.qtpl:27
	qw422016.N().Q(v.Value)
//line app/vlselect/logsql/logsql.qtpl:27
	qw422016.N().S(`,"hits":`)
//line app/vlselect/logsql/logsql.qtpl:28
	qw422016.N().DUL(v.Hits)
//line app/vlselect/logsql/logsql.qtpl:28
	qw422016.N().S(`}`)
//line app/vlselect/logsql/logsql.qtpl:30
}

//line app/vlselect/logsql/logsql.qtpl:30
func writevalueWithHitsJSON(qq422016 qtio422016.Writer, v logstorage.ValueWithHits) {
//line app/vlselect/logsql/logsql.qtpl:30
	qw422016 := qt422016.AcquireWriter(qq422016)
//line app/vlselect/logsql/logsql.qtpl:30
	streamvalueWithHitsJSON(qw422016, v)
//line app/vlselect/logsql/logsql.qtpl:30
	qt422016.ReleaseWriter(qw422016)
//line app/vlselect/logsql/logsql.qtpl:30
}

//line app/vlselect/logsql/logsql.qtpl:30
func valueWithHitsJSON(v logstorage.ValueWithHits) string {
//line app/vlselect/logsql/logsql.qtpl:30
	qb422016 := qt422016.AcquireByteBuffer()
//line app/vlselect/logsql/logsql.qtpl:30
	writevalueWithHitsJSON(qb422016, v)
//line app/vlselect/logsql/logsql.qtpl:30
	qs422016 := string(qb422016.B)
//line app/vlselect/logsql/logsql.qtpl:30
	qt422016.ReleaseByteBuffer(qb422016)
//line app/vlselect/logsql/logsql.qtpl:30
	return qs422016
//line app/vlselect/logsql/logsql.qtpl:30
}
