2023-06-20 05:55:12 +00:00
|
|
|
// Code generated by qtc from "query_response.qtpl". DO NOT EDIT.
|
|
|
|
// See https://github.com/valyala/quicktemplate for details.
|
|
|
|
|
|
|
|
//line app/vlselect/logsql/query_response.qtpl:1
|
|
|
|
package logsql
|
|
|
|
|
|
|
|
//line app/vlselect/logsql/query_response.qtpl:1
|
|
|
|
import (
|
|
|
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/logstorage"
|
|
|
|
)
|
|
|
|
|
|
|
|
// JSONRow creates JSON row from the given fields.
|
|
|
|
|
|
|
|
//line app/vlselect/logsql/query_response.qtpl:8
|
|
|
|
import (
|
|
|
|
qtio422016 "io"
|
|
|
|
|
|
|
|
qt422016 "github.com/valyala/quicktemplate"
|
|
|
|
)
|
|
|
|
|
|
|
|
//line app/vlselect/logsql/query_response.qtpl:8
|
|
|
|
var (
|
|
|
|
_ = qtio422016.Copy
|
|
|
|
_ = qt422016.AcquireByteBuffer
|
|
|
|
)
|
|
|
|
|
|
|
|
//line app/vlselect/logsql/query_response.qtpl:8
|
|
|
|
func StreamJSONRow(qw422016 *qt422016.Writer, columns []logstorage.BlockColumn, rowIdx int) {
|
|
|
|
//line app/vlselect/logsql/query_response.qtpl:10
|
2024-10-14 21:39:29 +00:00
|
|
|
i := 0
|
|
|
|
for i < len(columns) && columns[i].Values[rowIdx] == "" {
|
|
|
|
i++
|
|
|
|
}
|
|
|
|
columns = columns[i:]
|
|
|
|
|
|
|
|
//line app/vlselect/logsql/query_response.qtpl:16
|
|
|
|
if len(columns) == 0 {
|
|
|
|
//line app/vlselect/logsql/query_response.qtpl:17
|
|
|
|
return
|
|
|
|
//line app/vlselect/logsql/query_response.qtpl:18
|
|
|
|
}
|
|
|
|
//line app/vlselect/logsql/query_response.qtpl:18
|
|
|
|
qw422016.N().S(`{`)
|
|
|
|
//line app/vlselect/logsql/query_response.qtpl:20
|
2023-06-20 05:55:12 +00:00
|
|
|
c := &columns[0]
|
|
|
|
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:21
|
2023-06-20 05:55:12 +00:00
|
|
|
qw422016.N().Q(c.Name)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:21
|
2023-06-20 05:55:12 +00:00
|
|
|
qw422016.N().S(`:`)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:21
|
2023-06-20 05:55:12 +00:00
|
|
|
qw422016.N().Q(c.Values[rowIdx])
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:22
|
2023-06-20 05:55:12 +00:00
|
|
|
columns = columns[1:]
|
|
|
|
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:23
|
2023-06-20 05:55:12 +00:00
|
|
|
for colIdx := range columns {
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:25
|
2023-06-20 05:55:12 +00:00
|
|
|
c := &columns[colIdx]
|
2024-10-14 21:39:29 +00:00
|
|
|
v := c.Values[rowIdx]
|
2023-06-20 05:55:12 +00:00
|
|
|
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:28
|
|
|
|
if v == "" {
|
|
|
|
//line app/vlselect/logsql/query_response.qtpl:29
|
|
|
|
continue
|
|
|
|
//line app/vlselect/logsql/query_response.qtpl:30
|
|
|
|
}
|
|
|
|
//line app/vlselect/logsql/query_response.qtpl:30
|
2023-06-20 05:55:12 +00:00
|
|
|
qw422016.N().S(`,`)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:31
|
2023-06-20 05:55:12 +00:00
|
|
|
qw422016.N().Q(c.Name)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:31
|
2023-06-20 05:55:12 +00:00
|
|
|
qw422016.N().S(`:`)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:31
|
2023-06-20 05:55:12 +00:00
|
|
|
qw422016.N().Q(c.Values[rowIdx])
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:32
|
2023-06-20 05:55:12 +00:00
|
|
|
}
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:32
|
2023-06-20 05:55:12 +00:00
|
|
|
qw422016.N().S(`}`)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:33
|
2023-06-20 05:55:12 +00:00
|
|
|
qw422016.N().S(`
|
|
|
|
`)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:34
|
2023-06-20 05:55:12 +00:00
|
|
|
}
|
|
|
|
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:34
|
2023-06-20 05:55:12 +00:00
|
|
|
func WriteJSONRow(qq422016 qtio422016.Writer, columns []logstorage.BlockColumn, rowIdx int) {
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:34
|
2023-06-20 05:55:12 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:34
|
2023-06-20 05:55:12 +00:00
|
|
|
StreamJSONRow(qw422016, columns, rowIdx)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:34
|
2023-06-20 05:55:12 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:34
|
2023-06-20 05:55:12 +00:00
|
|
|
}
|
|
|
|
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:34
|
2023-06-20 05:55:12 +00:00
|
|
|
func JSONRow(columns []logstorage.BlockColumn, rowIdx int) string {
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:34
|
2023-06-20 05:55:12 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:34
|
2023-06-20 05:55:12 +00:00
|
|
|
WriteJSONRow(qb422016, columns, rowIdx)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:34
|
2023-06-20 05:55:12 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:34
|
2023-06-20 05:55:12 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:34
|
2023-06-20 05:55:12 +00:00
|
|
|
return qs422016
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:34
|
2023-06-20 05:55:12 +00:00
|
|
|
}
|
2023-06-21 08:10:45 +00:00
|
|
|
|
|
|
|
// JSONRows prints formatted rows
|
|
|
|
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:37
|
2023-06-21 08:10:45 +00:00
|
|
|
func StreamJSONRows(qw422016 *qt422016.Writer, rows [][]logstorage.Field) {
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:38
|
2023-06-21 08:10:45 +00:00
|
|
|
if len(rows) == 0 {
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:39
|
2023-06-21 08:10:45 +00:00
|
|
|
return
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:40
|
2023-06-21 08:10:45 +00:00
|
|
|
}
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:41
|
2023-06-21 08:10:45 +00:00
|
|
|
for _, fields := range rows {
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:42
|
|
|
|
fields = logstorage.SkipLeadingFieldsWithoutValues(fields)
|
|
|
|
|
|
|
|
//line app/vlselect/logsql/query_response.qtpl:43
|
|
|
|
if len(fields) == 0 {
|
|
|
|
//line app/vlselect/logsql/query_response.qtpl:44
|
|
|
|
continue
|
|
|
|
//line app/vlselect/logsql/query_response.qtpl:45
|
|
|
|
}
|
|
|
|
//line app/vlselect/logsql/query_response.qtpl:45
|
2023-06-21 08:10:45 +00:00
|
|
|
qw422016.N().S(`{`)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:47
|
2023-06-21 08:10:45 +00:00
|
|
|
if len(fields) > 0 {
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:49
|
2023-06-21 08:10:45 +00:00
|
|
|
f := fields[0]
|
|
|
|
fields = fields[1:]
|
|
|
|
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:52
|
2023-06-21 08:10:45 +00:00
|
|
|
qw422016.N().Q(f.Name)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:52
|
2023-06-21 08:10:45 +00:00
|
|
|
qw422016.N().S(`:`)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:52
|
2023-06-21 08:10:45 +00:00
|
|
|
qw422016.N().Q(f.Value)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:53
|
2023-06-21 08:10:45 +00:00
|
|
|
for _, f := range fields {
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:54
|
|
|
|
if f.Value == "" {
|
|
|
|
//line app/vlselect/logsql/query_response.qtpl:55
|
|
|
|
continue
|
|
|
|
//line app/vlselect/logsql/query_response.qtpl:56
|
|
|
|
}
|
|
|
|
//line app/vlselect/logsql/query_response.qtpl:56
|
2023-06-21 08:10:45 +00:00
|
|
|
qw422016.N().S(`,`)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:57
|
2023-06-21 08:10:45 +00:00
|
|
|
qw422016.N().Q(f.Name)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:57
|
2023-06-21 08:10:45 +00:00
|
|
|
qw422016.N().S(`:`)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:57
|
2023-06-21 08:10:45 +00:00
|
|
|
qw422016.N().Q(f.Value)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:58
|
2023-06-21 08:10:45 +00:00
|
|
|
}
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:59
|
2023-06-21 08:10:45 +00:00
|
|
|
}
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:59
|
2023-06-21 08:10:45 +00:00
|
|
|
qw422016.N().S(`}`)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:60
|
2023-06-21 08:10:45 +00:00
|
|
|
qw422016.N().S(`
|
|
|
|
`)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:61
|
2023-06-21 08:10:45 +00:00
|
|
|
}
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:62
|
2023-06-21 08:10:45 +00:00
|
|
|
}
|
|
|
|
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:62
|
2023-06-21 08:10:45 +00:00
|
|
|
func WriteJSONRows(qq422016 qtio422016.Writer, rows [][]logstorage.Field) {
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:62
|
2023-06-21 08:10:45 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:62
|
2023-06-21 08:10:45 +00:00
|
|
|
StreamJSONRows(qw422016, rows)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:62
|
2023-06-21 08:10:45 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:62
|
2023-06-21 08:10:45 +00:00
|
|
|
}
|
|
|
|
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:62
|
2023-06-21 08:10:45 +00:00
|
|
|
func JSONRows(rows [][]logstorage.Field) string {
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:62
|
2023-06-21 08:10:45 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:62
|
2023-06-21 08:10:45 +00:00
|
|
|
WriteJSONRows(qb422016, rows)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:62
|
2023-06-21 08:10:45 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:62
|
2023-06-21 08:10:45 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:62
|
2023-06-21 08:10:45 +00:00
|
|
|
return qs422016
|
2024-10-14 21:39:29 +00:00
|
|
|
//line app/vlselect/logsql/query_response.qtpl:62
|
2023-06-21 08:10:45 +00:00
|
|
|
}
|