diff --git a/go.mod b/go.mod index 007132bddf3..c2952cedc62 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/gorilla/websocket v1.4.1 github.com/gosimple/slug v1.4.2 github.com/grafana/grafana-plugin-model v0.0.0-20190930120109-1fc953a61fb4 - github.com/grafana/grafana-plugin-sdk-go v0.6.0 + github.com/grafana/grafana-plugin-sdk-go v0.11.0 github.com/hashicorp/go-hclog v0.8.0 github.com/hashicorp/go-plugin v1.0.1 github.com/hashicorp/go-version v1.1.0 diff --git a/go.sum b/go.sum index e3db1db93d1..176cac1e824 100644 --- a/go.sum +++ b/go.sum @@ -11,6 +11,8 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/apache/arrow/go/arrow v0.0.0-20190716210558-5f564424c71c h1:iHUHzx3S1TU5xt+D7vLb0PAk3e+RfayF9IhR6+hyO/k= github.com/apache/arrow/go/arrow v0.0.0-20190716210558-5f564424c71c/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= +github.com/apache/arrow/go/arrow v0.0.0-20191025121910-b789226ccb21 h1:xI+FQ/TsyD7jy22vP9wQBtJsPFRQTLZHfrr1IMLl0g0= +github.com/apache/arrow/go/arrow v0.0.0-20191025121910-b789226ccb21/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/aws/aws-sdk-go v1.25.48 h1:J82DYDGZHOKHdhx6hD24Tm30c2C3GchYGfN0mf9iKUk= github.com/aws/aws-sdk-go v1.25.48/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/beevik/etree v1.0.1/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A= @@ -28,6 +30,8 @@ github.com/bradfitz/gomemcache v0.0.0-20190329173943-551aad21a668 h1:U/lr3Dgy4WK github.com/bradfitz/gomemcache v0.0.0-20190329173943-551aad21a668/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cheekybits/genny v1.0.0 h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE= +github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= @@ -125,6 +129,8 @@ github.com/grafana/grafana-plugin-model v0.0.0-20190930120109-1fc953a61fb4 h1:SP github.com/grafana/grafana-plugin-model v0.0.0-20190930120109-1fc953a61fb4/go.mod h1:nc0XxBzjeGcrMltCDw269LoWF9S8ibhgxolCdA1R8To= github.com/grafana/grafana-plugin-sdk-go v0.6.0 h1:rMMp84CdEKxI4i6SEpIUgsHgcKa1JdXDjLrDDw6QhXI= github.com/grafana/grafana-plugin-sdk-go v0.6.0/go.mod h1:0eV4vNOYNZKOBbl23MieYiLa2y8M8S3D6ytLdggctqo= +github.com/grafana/grafana-plugin-sdk-go v0.11.0 h1:MkefJEWDMYk86eHUzCatTfK2/atAYNN1FncBqP5mx20= +github.com/grafana/grafana-plugin-sdk-go v0.11.0/go.mod h1:Dgc2ygLBJXTTIcfIgCGG6mxRcC/aZ36rKZ1tq5B5XmY= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI= diff --git a/vendor/github.com/apache/arrow/go/arrow/array/data.go b/vendor/github.com/apache/arrow/go/arrow/array/data.go index 58b16483bb8..e7a69e984b7 100644 --- a/vendor/github.com/apache/arrow/go/arrow/array/data.go +++ b/vendor/github.com/apache/arrow/go/arrow/array/data.go @@ -99,7 +99,7 @@ func (d *Data) Buffers() []*memory.Buffer { return d.buffers } // NewSliceData panics if the slice is outside the valid range of the input Data. // NewSliceData panics if j < i. func NewSliceData(data *Data, i, j int64) *Data { - if j > int64(data.length) || i > j || data.offset+int(i) > data.length { + if j > int64(data.length) || i > j || data.offset+int(i) > data.offset+data.length { panic("arrow/array: index out of range") } diff --git a/vendor/github.com/apache/arrow/go/arrow/ipc/file_reader.go b/vendor/github.com/apache/arrow/go/arrow/ipc/file_reader.go index 5de7efb4ec7..813f5838b72 100644 --- a/vendor/github.com/apache/arrow/go/arrow/ipc/file_reader.go +++ b/vendor/github.com/apache/arrow/go/arrow/ipc/file_reader.go @@ -82,7 +82,7 @@ func NewFileReader(r ReadAtSeeker, opts ...Option) (*FileReader, error) { } if cfg.schema != nil && !cfg.schema.Equal(f.schema) { - return nil, errors.Errorf("arrow/ipc: inconsitent schema for reading (got: %v, want: %v)", f.schema, cfg.schema) + return nil, errors.Errorf("arrow/ipc: inconsistent schema for reading (got: %v, want: %v)", f.schema, cfg.schema) } return &f, err diff --git a/vendor/github.com/apache/arrow/go/arrow/ipc/ipc.go b/vendor/github.com/apache/arrow/go/arrow/ipc/ipc.go index e6889743dfd..4c0eb4b61e6 100644 --- a/vendor/github.com/apache/arrow/go/arrow/ipc/ipc.go +++ b/vendor/github.com/apache/arrow/go/arrow/ipc/ipc.go @@ -37,8 +37,9 @@ const ( ) var ( - paddingBytes [kArrowAlignment]byte - kEOS = [4]byte{0, 0, 0, 0} // end of stream message + paddingBytes [kArrowAlignment]byte + kEOS = [8]byte{0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0, 0} // end of stream message + kIPCContToken uint32 = 0xFFFFFFFF // 32b continuation indicator for FlatBuffers 8b alignment ) func paddedLength(nbytes int64, alignment int32) int64 { diff --git a/vendor/github.com/apache/arrow/go/arrow/ipc/message.go b/vendor/github.com/apache/arrow/go/arrow/ipc/message.go index bb12dbbc518..bfd9494b6cb 100644 --- a/vendor/github.com/apache/arrow/go/arrow/ipc/message.go +++ b/vendor/github.com/apache/arrow/go/arrow/ipc/message.go @@ -181,12 +181,31 @@ func (r *MessageReader) Message() (*Message, error) { var buf = make([]byte, 4) _, err := io.ReadFull(r.r, buf) if err != nil { - return nil, errors.Wrap(err, "arrow/ipc: could not read message length") + return nil, errors.Wrap(err, "arrow/ipc: could not read continuation indicator") } - msgLen := int32(binary.LittleEndian.Uint32(buf)) - if msgLen == 0 { - // optional 0 EOS control message + var ( + cid = binary.LittleEndian.Uint32(buf) + msgLen int32 + ) + switch cid { + case 0: + // EOS message. return nil, io.EOF // FIXME(sbinet): send nil instead? or a special EOS error? + case kIPCContToken: + _, err = io.ReadFull(r.r, buf) + if err != nil { + return nil, errors.Wrap(err, "arrow/ipc: could not read message length") + } + msgLen = int32(binary.LittleEndian.Uint32(buf)) + if msgLen == 0 { + // optional 0 EOS control message + return nil, io.EOF // FIXME(sbinet): send nil instead? or a special EOS error? + } + + default: + // ARROW-6314: backwards compatibility for reading old IPC + // messages produced prior to version 0.15.0 + msgLen = int32(cid) } buf = make([]byte, msgLen) diff --git a/vendor/github.com/apache/arrow/go/arrow/ipc/metadata.go b/vendor/github.com/apache/arrow/go/arrow/ipc/metadata.go index 7b4e3dad433..034d3e124f4 100644 --- a/vendor/github.com/apache/arrow/go/arrow/ipc/metadata.go +++ b/vendor/github.com/apache/arrow/go/arrow/ipc/metadata.go @@ -88,7 +88,19 @@ func (blk fileBlock) NewMessage() (*Message, error) { if err != nil { return nil, errors.Wrap(err, "arrow/ipc: could not read message metadata") } - meta := memory.NewBufferBytes(buf[4:]) // drop buf-size already known from blk.Meta + + prefix := 0 + switch binary.LittleEndian.Uint32(buf) { + case 0: + case kIPCContToken: + prefix = 8 + default: + // ARROW-6314: backwards compatibility for reading old IPC + // messages produced prior to version 0.15.0 + prefix = 4 + } + + meta := memory.NewBufferBytes(buf[prefix:]) // drop buf-size already known from blk.Meta buf = make([]byte, blk.Body) _, err = io.ReadFull(r, buf) @@ -1002,19 +1014,26 @@ func writeMessage(msg *memory.Buffer, alignment int32, w io.Writer) (int, error) ) // ARROW-3212: we do not make any assumption on whether the output stream is aligned or not. - paddedMsgLen := int32(msg.Len()) + 4 + paddedMsgLen := int32(msg.Len()) + 8 remainder := paddedMsgLen % alignment if remainder != 0 { paddedMsgLen += alignment - remainder } + tmp := make([]byte, 4) + + // write continuation indicator, to address 8-byte alignment requirement from FlatBuffers. + binary.LittleEndian.PutUint32(tmp, kIPCContToken) + _, err = w.Write(tmp) + if err != nil { + return 0, errors.Wrap(err, "arrow/ipc: could not write continuation bit indicator") + } + // the returned message size includes the length prefix, the flatbuffer, + padding n = int(paddedMsgLen) - tmp := make([]byte, 4) - // write the flatbuffer size prefix, including padding - sizeFB := paddedMsgLen - 4 + sizeFB := paddedMsgLen - 8 binary.LittleEndian.PutUint32(tmp, uint32(sizeFB)) _, err = w.Write(tmp) if err != nil { @@ -1028,7 +1047,7 @@ func writeMessage(msg *memory.Buffer, alignment int32, w io.Writer) (int, error) } // write any padding - padding := paddedMsgLen - int32(msg.Len()) - 4 + padding := paddedMsgLen - int32(msg.Len()) - 8 if padding > 0 { _, err = w.Write(paddingBytes[:padding]) if err != nil { diff --git a/vendor/github.com/cheekybits/genny/LICENSE b/vendor/github.com/cheekybits/genny/LICENSE new file mode 100644 index 00000000000..519d7f22729 --- /dev/null +++ b/vendor/github.com/cheekybits/genny/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2014 cheekybits + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/vendor/github.com/cheekybits/genny/generic/doc.go b/vendor/github.com/cheekybits/genny/generic/doc.go new file mode 100644 index 00000000000..3bd6c869c0f --- /dev/null +++ b/vendor/github.com/cheekybits/genny/generic/doc.go @@ -0,0 +1,2 @@ +// Package generic contains the generic marker types. +package generic diff --git a/vendor/github.com/cheekybits/genny/generic/generic.go b/vendor/github.com/cheekybits/genny/generic/generic.go new file mode 100644 index 00000000000..04a2306cbf1 --- /dev/null +++ b/vendor/github.com/cheekybits/genny/generic/generic.go @@ -0,0 +1,13 @@ +package generic + +// Type is the placeholder type that indicates a generic value. +// When genny is executed, variables of this type will be replaced with +// references to the specific types. +// var GenericType generic.Type +type Type interface{} + +// Number is the placehoder type that indiccates a generic numerical value. +// When genny is executed, variables of this type will be replaced with +// references to the specific types. +// var GenericType generic.Number +type Number float64 diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/arrow.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/arrow.go index dcb0fd8179a..f22f224b51f 100644 --- a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/arrow.go +++ b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/arrow.go @@ -1,6 +1,7 @@ package dataframe import ( + "encoding/json" "fmt" "io" "time" @@ -83,6 +84,13 @@ func buildArrowFields(f *Frame) ([]arrow.Field, error) { "name": field.Name, "labels": field.Labels.String(), } + if field.Config != nil { + str, err := toJSONString(field.Config) + if err != nil { + return nil, err + } + fieldMeta["config"] = str + } arrowFields[i] = arrow.Field{ Name: field.Name, @@ -103,34 +111,69 @@ func buildArrowColumns(f *Frame, arrowFields []arrow.Field) ([]array.Column, err for fieldIdx, field := range f.Fields { switch v := field.Vector.(type) { - case *intVector: - columns[fieldIdx] = *buildIntColumn(pool, arrowFields[fieldIdx], v) - case *nullableIntVector: - columns[fieldIdx] = *buildNullableIntColumn(pool, arrowFields[fieldIdx], v) + case *int8Vector: + columns[fieldIdx] = *buildInt8Column(pool, arrowFields[fieldIdx], v) + case *nullableInt8Vector: + columns[fieldIdx] = *buildNullableInt8Column(pool, arrowFields[fieldIdx], v) - case *uintVector: - columns[fieldIdx] = *buildUIntColumn(pool, arrowFields[fieldIdx], v) - case *nullableUintVector: - columns[fieldIdx] = *buildNullableUIntColumn(pool, arrowFields[fieldIdx], v) + case *int16Vector: + columns[fieldIdx] = *buildInt16Column(pool, arrowFields[fieldIdx], v) + case *nullableInt16Vector: + columns[fieldIdx] = *buildNullableInt16Column(pool, arrowFields[fieldIdx], v) + + case *int32Vector: + columns[fieldIdx] = *buildInt32Column(pool, arrowFields[fieldIdx], v) + case *nullableInt32Vector: + columns[fieldIdx] = *buildNullableInt32Column(pool, arrowFields[fieldIdx], v) + + case *int64Vector: + columns[fieldIdx] = *buildInt64Column(pool, arrowFields[fieldIdx], v) + case *nullableInt64Vector: + columns[fieldIdx] = *buildNullableInt64Column(pool, arrowFields[fieldIdx], v) + + case *uint8Vector: + columns[fieldIdx] = *buildUInt8Column(pool, arrowFields[fieldIdx], v) + case *nullableUint8Vector: + columns[fieldIdx] = *buildNullableUInt8Column(pool, arrowFields[fieldIdx], v) + + case *uint16Vector: + columns[fieldIdx] = *buildUInt16Column(pool, arrowFields[fieldIdx], v) + case *nullableUint16Vector: + columns[fieldIdx] = *buildNullableUInt16Column(pool, arrowFields[fieldIdx], v) + + case *uint32Vector: + columns[fieldIdx] = *buildUInt32Column(pool, arrowFields[fieldIdx], v) + case *nullableUint32Vector: + columns[fieldIdx] = *buildNullableUInt32Column(pool, arrowFields[fieldIdx], v) + + case *uint64Vector: + columns[fieldIdx] = *buildUInt64Column(pool, arrowFields[fieldIdx], v) + case *nullableUint64Vector: + columns[fieldIdx] = *buildNullableUInt64Column(pool, arrowFields[fieldIdx], v) case *stringVector: columns[fieldIdx] = *buildStringColumn(pool, arrowFields[fieldIdx], v) case *nullableStringVector: columns[fieldIdx] = *buildNullableStringColumn(pool, arrowFields[fieldIdx], v) - case *floatVector: - columns[fieldIdx] = *buildFloatColumn(pool, arrowFields[fieldIdx], v) - case *nullableFloatVector: - columns[fieldIdx] = *buildNullableFloatColumn(pool, arrowFields[fieldIdx], v) + case *float32Vector: + columns[fieldIdx] = *buildFloat32Column(pool, arrowFields[fieldIdx], v) + case *nullableFloat32Vector: + columns[fieldIdx] = *buildNullableFloat32Column(pool, arrowFields[fieldIdx], v) + + case *float64Vector: + columns[fieldIdx] = *buildFloat64Column(pool, arrowFields[fieldIdx], v) + case *nullableFloat64Vector: + columns[fieldIdx] = *buildNullableFloat64Column(pool, arrowFields[fieldIdx], v) case *boolVector: columns[fieldIdx] = *buildBoolColumn(pool, arrowFields[fieldIdx], v) case *nullableBoolVector: columns[fieldIdx] = *buildNullableBoolColumn(pool, arrowFields[fieldIdx], v) - case *timeVector: + case *timeTimeVector: columns[fieldIdx] = *buildTimeColumn(pool, arrowFields[fieldIdx], v) - case *nullableTimeVector: + case *nullableTimeTimeVector: columns[fieldIdx] = *buildNullableTimeColumn(pool, arrowFields[fieldIdx], v) default: @@ -146,7 +189,13 @@ func buildArrowSchema(f *Frame, fs []arrow.Field) (*arrow.Schema, error) { "name": f.Name, "refId": f.RefID, } - + if f.Meta != nil { + str, err := toJSONString(f.Meta) + if err != nil { + return nil, err + } + tableMetaMap["meta"] = str + } tableMeta := arrow.MetadataFrom(tableMetaMap) return arrow.NewSchema(fs, &tableMeta), nil @@ -162,19 +211,56 @@ func fieldToArrow(f *Field) (arrow.DataType, bool, error) { case *nullableStringVector: return &arrow.StringType{}, true, nil - case *intVector: + // Ints + case *int8Vector: + return &arrow.Int8Type{}, false, nil + case *nullableInt8Vector: + return &arrow.Int8Type{}, true, nil + + case *int16Vector: + return &arrow.Int16Type{}, false, nil + case *nullableInt16Vector: + return &arrow.Int16Type{}, true, nil + + case *int32Vector: + return &arrow.Int32Type{}, false, nil + case *nullableInt32Vector: + return &arrow.Int32Type{}, true, nil + + case *int64Vector: return &arrow.Int64Type{}, false, nil - case *nullableIntVector: + case *nullableInt64Vector: return &arrow.Int64Type{}, true, nil - case *uintVector: + // Uints + case *uint8Vector: + return &arrow.Uint8Type{}, false, nil + case *nullableUint8Vector: + return &arrow.Uint8Type{}, true, nil + + case *uint16Vector: + return &arrow.Uint16Type{}, false, nil + case *nullableUint16Vector: + return &arrow.Uint16Type{}, true, nil + + case *uint32Vector: + return &arrow.Uint32Type{}, false, nil + case *nullableUint32Vector: + return &arrow.Uint32Type{}, true, nil + + case *uint64Vector: return &arrow.Uint64Type{}, false, nil - case *nullableUintVector: + case *nullableUint64Vector: return &arrow.Uint64Type{}, true, nil - case *floatVector: + case *float32Vector: + return &arrow.Float32Type{}, false, nil + case *nullableFloat32Vector: + return &arrow.Float32Type{}, true, nil + + case *float64Vector: return &arrow.Float64Type{}, false, nil - case *nullableFloatVector: + case *nullableFloat64Vector: return &arrow.Float64Type{}, true, nil case *boolVector: @@ -182,9 +268,9 @@ func fieldToArrow(f *Field) (arrow.DataType, bool, error) { case *nullableBoolVector: return &arrow.BooleanType{}, true, nil - case *timeVector: + case *timeTimeVector: return &arrow.TimestampType{}, false, nil - case *nullableTimeVector: + case *nullableTimeTimeVector: return &arrow.TimestampType{}, true, nil default: @@ -213,6 +299,13 @@ func initializeFrameFields(schema *arrow.Schema, frame *Frame) ([]bool, error) { return nil, err } } + if configAsString, ok := getMDKey("config", field.Metadata); ok { + var err error + sdkField.Config, err = FieldConfigFromJSON(configAsString) + if err != nil { + return nil, err + } + } nullable[idx] = field.Nullable switch field.Type.ID() { case arrow.STRING: @@ -221,24 +314,66 @@ func initializeFrameFields(schema *arrow.Schema, frame *Frame) ([]bool, error) { break } sdkField.Vector = newStringVector(0) + case arrow.INT8: + if nullable[idx] { + sdkField.Vector = newNullableInt8Vector(0) + break + } + sdkField.Vector = newInt8Vector(0) + case arrow.INT16: + if nullable[idx] { + sdkField.Vector = newNullableInt16Vector(0) + break + } + sdkField.Vector = newInt16Vector(0) + case arrow.INT32: + if nullable[idx] { + sdkField.Vector = newNullableInt32Vector(0) + break + } + sdkField.Vector = newInt32Vector(0) case arrow.INT64: if nullable[idx] { - sdkField.Vector = newNullableIntVector(0) + sdkField.Vector = newNullableInt64Vector(0) break } - sdkField.Vector = newIntVector(0) + sdkField.Vector = newInt64Vector(0) + case arrow.UINT8: + if nullable[idx] { + sdkField.Vector = newNullableUint8Vector(0) + break + } + sdkField.Vector = newUint8Vector(0) + case arrow.UINT16: + if nullable[idx] { + sdkField.Vector = newNullableUint16Vector(0) + break + } + sdkField.Vector = newUint16Vector(0) + case arrow.UINT32: + if nullable[idx] { + sdkField.Vector = newNullableUint32Vector(0) + break + } + sdkField.Vector = newUint32Vector(0) case arrow.UINT64: if nullable[idx] { - sdkField.Vector = newNullableUintVector(0) + sdkField.Vector = newNullableUint64Vector(0) break } - sdkField.Vector = newUintVector(0) + sdkField.Vector = newUint64Vector(0) + case arrow.FLOAT32: + if nullable[idx] { + sdkField.Vector = newNullableFloat32Vector(0) + break + } + sdkField.Vector = newFloat32Vector(0) case arrow.FLOAT64: if nullable[idx] { - sdkField.Vector = newNullableFloatVector(0) + sdkField.Vector = newNullableFloat64Vector(0) break } - sdkField.Vector = newFloatVector(0) + sdkField.Vector = newFloat64Vector(0) case arrow.BOOL: if nullable[idx] { sdkField.Vector = newNullableBoolVector(0) @@ -247,13 +382,14 @@ func initializeFrameFields(schema *arrow.Schema, frame *Frame) ([]bool, error) { sdkField.Vector = newBoolVector(0) case arrow.TIMESTAMP: if nullable[idx] { - sdkField.Vector = newNullableTimeVector(0) + sdkField.Vector = newNullableTimeTimeVector(0) break } - sdkField.Vector = newTimeVector(0) + sdkField.Vector = newTimeTimeVector(0) default: return nullable, fmt.Errorf("unsupported conversion from arrow to sdk type for arrow type %v", field.Type.ID().String()) } + frame.Fields = append(frame.Fields, sdkField) } return nullable, nil @@ -286,6 +422,51 @@ func populateFrameFields(fR *ipc.FileReader, nullable []bool, frame *Frame) erro } frame.Fields[i].Vector.Append(v.Value(rIdx)) } + case arrow.INT8: + v := array.NewInt8Data(col.Data()) + for rIdx := 0; rIdx < col.Len(); rIdx++ { + if nullable[i] { + if v.IsNull(rIdx) { + var ns *int8 + frame.Fields[i].Vector.Append(ns) + continue + } + rv := v.Value(rIdx) + frame.Fields[i].Vector.Append(&rv) + continue + } + frame.Fields[i].Vector.Append(v.Value(rIdx)) + } + case arrow.INT16: + v := array.NewInt16Data(col.Data()) + for rIdx := 0; rIdx < col.Len(); rIdx++ { + if nullable[i] { + if v.IsNull(rIdx) { + var ns *int16 + frame.Fields[i].Vector.Append(ns) + continue + } + rv := v.Value(rIdx) + frame.Fields[i].Vector.Append(&rv) + continue + } + frame.Fields[i].Vector.Append(v.Value(rIdx)) + } + case arrow.INT32: + v := array.NewInt32Data(col.Data()) + for rIdx := 0; rIdx < col.Len(); rIdx++ { + if nullable[i] { + if v.IsNull(rIdx) { + var ns *int32 + frame.Fields[i].Vector.Append(ns) + continue + } + rv := v.Value(rIdx) + frame.Fields[i].Vector.Append(&rv) + continue + } + frame.Fields[i].Vector.Append(v.Value(rIdx)) + } case arrow.INT64: v := array.NewInt64Data(col.Data()) for rIdx := 0; rIdx < col.Len(); rIdx++ { @@ -301,6 +482,36 @@ func populateFrameFields(fR *ipc.FileReader, nullable []bool, frame *Frame) erro } frame.Fields[i].Vector.Append(v.Value(rIdx)) } + case arrow.UINT8: + v := array.NewUint8Data(col.Data()) + for rIdx := 0; rIdx < col.Len(); rIdx++ { + if nullable[i] { + if v.IsNull(rIdx) { + var ns *uint8 + frame.Fields[i].Vector.Append(ns) + continue + } + rv := v.Value(rIdx) + frame.Fields[i].Vector.Append(&rv) + continue + } + frame.Fields[i].Vector.Append(v.Value(rIdx)) + } + case arrow.UINT32: + v := array.NewUint32Data(col.Data()) + for rIdx := 0; rIdx < col.Len(); rIdx++ { + if nullable[i] { + if v.IsNull(rIdx) { + var ns *uint32 + frame.Fields[i].Vector.Append(ns) + continue + } + rv := v.Value(rIdx) + frame.Fields[i].Vector.Append(&rv) + continue + } + frame.Fields[i].Vector.Append(v.Value(rIdx)) + } case arrow.UINT64: v := array.NewUint64Data(col.Data()) for rIdx := 0; rIdx < col.Len(); rIdx++ { @@ -316,6 +527,36 @@ func populateFrameFields(fR *ipc.FileReader, nullable []bool, frame *Frame) erro } frame.Fields[i].Vector.Append(v.Value(rIdx)) } + case arrow.UINT16: + v := array.NewUint16Data(col.Data()) + for rIdx := 0; rIdx < col.Len(); rIdx++ { + if nullable[i] { + if v.IsNull(rIdx) { + var ns *uint16 + frame.Fields[i].Vector.Append(ns) + continue + } + rv := v.Value(rIdx) + frame.Fields[i].Vector.Append(&rv) + continue + } + frame.Fields[i].Vector.Append(v.Value(rIdx)) + } + case arrow.FLOAT32: + v := array.NewFloat32Data(col.Data()) + for vIdx, f := range v.Float32Values() { + if nullable[i] { + if v.IsNull(vIdx) { + var nf *float32 + frame.Fields[i].Vector.Append(nf) + continue + } + vF := f + frame.Fields[i].Vector.Append(&vF) + continue + } + frame.Fields[i].Vector.Append(f) + } case arrow.FLOAT64: v := array.NewFloat64Data(col.Data()) for vIdx, f := range v.Float64Values() { @@ -383,6 +624,15 @@ func UnmarshalArrow(b []byte) (*Frame, error) { frame := &Frame{} frame.Name, _ = getMDKey("name", metaData) // No need to check ok, zero value ("") is returned frame.RefID, _ = getMDKey("refId", metaData) + + if metaAsString, ok := getMDKey("meta", metaData); ok { + var err error + frame.Meta, err = QueryResultMetaFromJSON(metaAsString) + if err != nil { + return nil, err + } + } + nullable, err := initializeFrameFields(schema, frame) if err != nil { return nil, err @@ -394,3 +644,12 @@ func UnmarshalArrow(b []byte) (*Frame, error) { } return frame, nil } + +// ToJSONString return the FieldConfig as a json string +func toJSONString(val interface{}) (string, error) { + b, err := json.Marshal(val) + if err != nil { + return "", err + } + return string(b), nil +} diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/arrow_column_builders.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/arrow_column_builders.go index 07056213429..c3d845e3b85 100644 --- a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/arrow_column_builders.go +++ b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/arrow_column_builders.go @@ -10,7 +10,7 @@ func buildStringColumn(pool memory.Allocator, field arrow.Field, vec *stringVect builder := array.NewStringBuilder(pool) defer builder.Release() - for _, v := range *vec { + for _, v := range (*vec) { builder.Append(v) } @@ -24,7 +24,7 @@ func buildNullableStringColumn(pool memory.Allocator, field arrow.Field, vec *nu builder := array.NewStringBuilder(pool) defer builder.Release() - for _, v := range *vec { + for _, v := range (*vec) { if v == nil { builder.AppendNull() continue @@ -38,11 +38,107 @@ func buildNullableStringColumn(pool memory.Allocator, field arrow.Field, vec *nu return array.NewColumn(field, chunked) } -func buildIntColumn(pool memory.Allocator, field arrow.Field, vec *intVector) *array.Column { +func buildInt8Column(pool memory.Allocator, field arrow.Field, vec *int8Vector) *array.Column { + builder := array.NewInt8Builder(pool) + defer builder.Release() + + for _, v := range (*vec) { + builder.Append(v) + } + + chunked := array.NewChunked(field.Type, []array.Interface{builder.NewArray()}) + defer chunked.Release() + + return array.NewColumn(field, chunked) +} + +func buildNullableInt8Column(pool memory.Allocator, field arrow.Field, vec *nullableInt8Vector) *array.Column { + builder := array.NewInt8Builder(pool) + defer builder.Release() + + for _, v := range (*vec) { + if v == nil { + builder.AppendNull() + continue + } + builder.Append(*v) + } + + chunked := array.NewChunked(field.Type, []array.Interface{builder.NewArray()}) + defer chunked.Release() + + return array.NewColumn(field, chunked) +} + +func buildInt16Column(pool memory.Allocator, field arrow.Field, vec *int16Vector) *array.Column { + builder := array.NewInt16Builder(pool) + defer builder.Release() + + for _, v := range (*vec) { + builder.Append(v) + } + + chunked := array.NewChunked(field.Type, []array.Interface{builder.NewArray()}) + defer chunked.Release() + + return array.NewColumn(field, chunked) +} + +func buildNullableInt16Column(pool memory.Allocator, field arrow.Field, vec *nullableInt16Vector) *array.Column { + builder := array.NewInt16Builder(pool) + defer builder.Release() + + for _, v := range (*vec) { + if v == nil { + builder.AppendNull() + continue + } + builder.Append(*v) + } + + chunked := array.NewChunked(field.Type, []array.Interface{builder.NewArray()}) + defer chunked.Release() + + return array.NewColumn(field, chunked) +} + +func buildInt32Column(pool memory.Allocator, field arrow.Field, vec *int32Vector) *array.Column { + builder := array.NewInt32Builder(pool) + defer builder.Release() + + for _, v := range (*vec) { + builder.Append(v) + } + + chunked := array.NewChunked(field.Type, []array.Interface{builder.NewArray()}) + defer chunked.Release() + + return array.NewColumn(field, chunked) +} + +func buildNullableInt32Column(pool memory.Allocator, field arrow.Field, vec *nullableInt32Vector) *array.Column { + builder := array.NewInt32Builder(pool) + defer builder.Release() + + for _, v := range (*vec) { + if v == nil { + builder.AppendNull() + continue + } + builder.Append(*v) + } + + chunked := array.NewChunked(field.Type, []array.Interface{builder.NewArray()}) + defer chunked.Release() + + return array.NewColumn(field, chunked) +} + +func buildInt64Column(pool memory.Allocator, field arrow.Field, vec *int64Vector) *array.Column { builder := array.NewInt64Builder(pool) defer builder.Release() - for _, v := range *vec { + for _, v := range (*vec) { builder.Append(v) } @@ -52,11 +148,11 @@ func buildIntColumn(pool memory.Allocator, field arrow.Field, vec *intVector) *a return array.NewColumn(field, chunked) } -func buildNullableIntColumn(pool memory.Allocator, field arrow.Field, vec *nullableIntVector) *array.Column { +func buildNullableInt64Column(pool memory.Allocator, field arrow.Field, vec *nullableInt64Vector) *array.Column { builder := array.NewInt64Builder(pool) defer builder.Release() - for _, v := range *vec { + for _, v := range (*vec) { if v == nil { builder.AppendNull() continue @@ -70,11 +166,11 @@ func buildNullableIntColumn(pool memory.Allocator, field arrow.Field, vec *nulla return array.NewColumn(field, chunked) } -func buildUIntColumn(pool memory.Allocator, field arrow.Field, vec *uintVector) *array.Column { - builder := array.NewUint64Builder(pool) +func buildUInt8Column(pool memory.Allocator, field arrow.Field, vec *uint8Vector) *array.Column { + builder := array.NewUint8Builder(pool) defer builder.Release() - for _, v := range *vec { + for _, v := range (*vec) { builder.Append(v) } @@ -84,11 +180,11 @@ func buildUIntColumn(pool memory.Allocator, field arrow.Field, vec *uintVector) return array.NewColumn(field, chunked) } -func buildNullableUIntColumn(pool memory.Allocator, field arrow.Field, vec *nullableUintVector) *array.Column { - builder := array.NewUint64Builder(pool) +func buildNullableUInt8Column(pool memory.Allocator, field arrow.Field, vec *nullableUint8Vector) *array.Column { + builder := array.NewUint8Builder(pool) defer builder.Release() - for _, v := range *vec { + for _, v := range (*vec) { if v == nil { builder.AppendNull() continue @@ -102,11 +198,11 @@ func buildNullableUIntColumn(pool memory.Allocator, field arrow.Field, vec *null return array.NewColumn(field, chunked) } -func buildFloatColumn(pool memory.Allocator, field arrow.Field, vec *floatVector) *array.Column { - builder := array.NewFloat64Builder(pool) +func buildUInt16Column(pool memory.Allocator, field arrow.Field, vec *uint16Vector) *array.Column { + builder := array.NewUint16Builder(pool) defer builder.Release() - for _, v := range *vec { + for _, v := range (*vec) { builder.Append(v) } @@ -116,11 +212,139 @@ func buildFloatColumn(pool memory.Allocator, field arrow.Field, vec *floatVector return array.NewColumn(field, chunked) } -func buildNullableFloatColumn(pool memory.Allocator, field arrow.Field, vec *nullableFloatVector) *array.Column { +func buildNullableUInt16Column(pool memory.Allocator, field arrow.Field, vec *nullableUint16Vector) *array.Column { + builder := array.NewUint16Builder(pool) + defer builder.Release() + + for _, v := range (*vec) { + if v == nil { + builder.AppendNull() + continue + } + builder.Append(*v) + } + + chunked := array.NewChunked(field.Type, []array.Interface{builder.NewArray()}) + defer chunked.Release() + + return array.NewColumn(field, chunked) +} + +func buildUInt32Column(pool memory.Allocator, field arrow.Field, vec *uint32Vector) *array.Column { + builder := array.NewUint32Builder(pool) + defer builder.Release() + + for _, v := range (*vec) { + builder.Append(v) + } + + chunked := array.NewChunked(field.Type, []array.Interface{builder.NewArray()}) + defer chunked.Release() + + return array.NewColumn(field, chunked) +} + +func buildNullableUInt32Column(pool memory.Allocator, field arrow.Field, vec *nullableUint32Vector) *array.Column { + builder := array.NewUint32Builder(pool) + defer builder.Release() + + for _, v := range (*vec) { + if v == nil { + builder.AppendNull() + continue + } + builder.Append(*v) + } + + chunked := array.NewChunked(field.Type, []array.Interface{builder.NewArray()}) + defer chunked.Release() + + return array.NewColumn(field, chunked) +} + +func buildUInt64Column(pool memory.Allocator, field arrow.Field, vec *uint64Vector) *array.Column { + builder := array.NewUint64Builder(pool) + defer builder.Release() + + for _, v := range (*vec) { + builder.Append(v) + } + + chunked := array.NewChunked(field.Type, []array.Interface{builder.NewArray()}) + defer chunked.Release() + + return array.NewColumn(field, chunked) +} + +func buildNullableUInt64Column(pool memory.Allocator, field arrow.Field, vec *nullableUint64Vector) *array.Column { + builder := array.NewUint64Builder(pool) + defer builder.Release() + + for _, v := range (*vec) { + if v == nil { + builder.AppendNull() + continue + } + builder.Append(*v) + } + + chunked := array.NewChunked(field.Type, []array.Interface{builder.NewArray()}) + defer chunked.Release() + + return array.NewColumn(field, chunked) +} + +func buildFloat32Column(pool memory.Allocator, field arrow.Field, vec *float32Vector) *array.Column { + builder := array.NewFloat32Builder(pool) + defer builder.Release() + + for _, v := range (*vec) { + builder.Append(v) + } + + chunked := array.NewChunked(field.Type, []array.Interface{builder.NewArray()}) + defer chunked.Release() + + return array.NewColumn(field, chunked) +} + +func buildNullableFloat32Column(pool memory.Allocator, field arrow.Field, vec *nullableFloat32Vector) *array.Column { + builder := array.NewFloat32Builder(pool) + defer builder.Release() + + for _, v := range (*vec) { + if v == nil { + builder.AppendNull() + continue + } + builder.Append(*v) + } + + chunked := array.NewChunked(field.Type, []array.Interface{builder.NewArray()}) + defer chunked.Release() + + return array.NewColumn(field, chunked) +} + +func buildFloat64Column(pool memory.Allocator, field arrow.Field, vec *float64Vector) *array.Column { builder := array.NewFloat64Builder(pool) defer builder.Release() - for _, v := range *vec { + for _, v := range (*vec) { + builder.Append(v) + } + + chunked := array.NewChunked(field.Type, []array.Interface{builder.NewArray()}) + defer chunked.Release() + + return array.NewColumn(field, chunked) +} + +func buildNullableFloat64Column(pool memory.Allocator, field arrow.Field, vec *nullableFloat64Vector) *array.Column { + builder := array.NewFloat64Builder(pool) + defer builder.Release() + + for _, v := range (*vec) { if v == nil { builder.AppendNull() continue @@ -138,7 +362,7 @@ func buildBoolColumn(pool memory.Allocator, field arrow.Field, vec *boolVector) builder := array.NewBooleanBuilder(pool) defer builder.Release() - for _, v := range *vec { + for _, v := range (*vec) { builder.Append(v) } @@ -152,7 +376,7 @@ func buildNullableBoolColumn(pool memory.Allocator, field arrow.Field, vec *null builder := array.NewBooleanBuilder(pool) defer builder.Release() - for _, v := range *vec { + for _, v := range (*vec) { if v == nil { builder.AppendNull() continue @@ -166,13 +390,13 @@ func buildNullableBoolColumn(pool memory.Allocator, field arrow.Field, vec *null return array.NewColumn(field, chunked) } -func buildTimeColumn(pool memory.Allocator, field arrow.Field, vec *timeVector) *array.Column { +func buildTimeColumn(pool memory.Allocator, field arrow.Field, vec *timeTimeVector) *array.Column { builder := array.NewTimestampBuilder(pool, &arrow.TimestampType{ Unit: arrow.Nanosecond, }) defer builder.Release() - for _, v := range *vec { + for _, v := range (*vec) { builder.Append(arrow.Timestamp((v).UnixNano())) } @@ -182,13 +406,13 @@ func buildTimeColumn(pool memory.Allocator, field arrow.Field, vec *timeVector) return array.NewColumn(field, chunked) } -func buildNullableTimeColumn(pool memory.Allocator, field arrow.Field, vec *nullableTimeVector) *array.Column { +func buildNullableTimeColumn(pool memory.Allocator, field arrow.Field, vec *nullableTimeTimeVector) *array.Column { builder := array.NewTimestampBuilder(pool, &arrow.TimestampType{ Unit: arrow.Nanosecond, }) defer builder.Release() - for _, v := range *vec { + for _, v := range (*vec) { if v == nil { builder.AppendNull() continue diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/dataframe.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/dataframe.go index 2f174c0f7b9..966318cb205 100644 --- a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/dataframe.go +++ b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/dataframe.go @@ -13,12 +13,14 @@ type Frame struct { Fields []*Field RefID string + Meta *QueryResultMeta } // Field represents a column of data with a specific type. type Field struct { Name string - Vector Vector + Config *FieldConfig + Vector Vector // TODO? in the frontend, the variable is called "Values" Labels Labels } @@ -29,6 +31,36 @@ type Fields []*Field func NewField(name string, labels Labels, values interface{}) *Field { var vec Vector switch v := values.(type) { + case []int8: + vec = newVector(v, len(v)) + for i := 0; i < len(v); i++ { + vec.Set(i, v[i]) + } + case []*int8: + vec = newVector(v, len(v)) + for i := 0; i < len(v); i++ { + vec.Set(i, v[i]) + } + case []int16: + vec = newVector(v, len(v)) + for i := 0; i < len(v); i++ { + vec.Set(i, v[i]) + } + case []*int16: + vec = newVector(v, len(v)) + for i := 0; i < len(v); i++ { + vec.Set(i, v[i]) + } + case []int32: + vec = newVector(v, len(v)) + for i := 0; i < len(v); i++ { + vec.Set(i, v[i]) + } + case []*int32: + vec = newVector(v, len(v)) + for i := 0; i < len(v); i++ { + vec.Set(i, v[i]) + } case []int64: vec = newVector(v, len(v)) for i := 0; i < len(v); i++ { @@ -39,6 +71,36 @@ func NewField(name string, labels Labels, values interface{}) *Field { for i := 0; i < len(v); i++ { vec.Set(i, v[i]) } + case []uint8: + vec = newVector(v, len(v)) + for i := 0; i < len(v); i++ { + vec.Set(i, v[i]) + } + case []*uint8: + vec = newVector(v, len(v)) + for i := 0; i < len(v); i++ { + vec.Set(i, v[i]) + } + case []uint16: + vec = newVector(v, len(v)) + for i := 0; i < len(v); i++ { + vec.Set(i, v[i]) + } + case []*uint16: + vec = newVector(v, len(v)) + for i := 0; i < len(v); i++ { + vec.Set(i, v[i]) + } + case []uint32: + vec = newVector(v, len(v)) + for i := 0; i < len(v); i++ { + vec.Set(i, v[i]) + } + case []*uint32: + vec = newVector(v, len(v)) + for i := 0; i < len(v); i++ { + vec.Set(i, v[i]) + } case []uint64: vec = newVector(v, len(v)) for i := 0; i < len(v); i++ { @@ -49,6 +111,16 @@ func NewField(name string, labels Labels, values interface{}) *Field { for i := 0; i < len(v); i++ { vec.Set(i, v[i]) } + case []float32: + vec = newVector(v, len(v)) + for i := 0; i < len(v); i++ { + vec.Set(i, v[i]) + } + case []*float32: + vec = newVector(v, len(v)) + for i := 0; i < len(v); i++ { + vec.Set(i, v[i]) + } case []float64: vec = newVector(v, len(v)) for i := 0; i < len(v); i++ { @@ -105,6 +177,13 @@ func (f *Field) Len() int { return f.Vector.Len() } +// SetConfig modifies the Field's Config property to +// be set to conf and returns the Field. +func (f *Field) SetConfig(conf *FieldConfig) *Field { + f.Config = conf + return f +} + // Labels are used to add metadata to an object. type Labels map[string]string diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/field_config.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/field_config.go new file mode 100644 index 00000000000..3b9f37682bd --- /dev/null +++ b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/field_config.go @@ -0,0 +1,198 @@ +package dataframe + +import ( + "encoding/json" + "fmt" + "math" + "strconv" +) + +// FieldConfig represents the display properties for a Field. +type FieldConfig struct { + + // This struct needs to match the frontend component defined in: + // https://github.com/grafana/grafana/blob/master/packages/grafana-data/src/types/dataFrame.ts#L23 + // All properties are optional should be omitted from JSON when empty or not set. + + Title string `json:"title,omitempty"` + Filterable *bool `json:"filterable,omitempty"` // indicates if the Field's data can be filtered by additional calls. + + // Numeric Options + Unit string `json:"unit,omitempty"` // is the string to display to represent the Field's unit, such as "Requests/sec" + Decimals *uint16 `json:"decimals,omitempty"` // is the number of decimal places to display + Min *ConfFloat64 `json:"min,omitempty"` // is the maximum value of fields in the column. When present the frontend can skip the calculation. + Max *ConfFloat64 `json:"max,omitempty"` // see Min + + // Convert input values into a display string + Mappings []ValueMapping `json:"mappings,omitempty"` + + // Map numeric values to states + Thresholds *ThresholdsConfig `json:"thresholds,omitempty"` + + // Map values to a display color + // NOTE: this interface is under development in the frontend... so simple map for now + Color map[string]interface{} `json:"color,omitempty"` + + // Used when reducing field values + NullValueMode NullValueMode `json:"nullValueMode,omitempty"` + + // The behavior when clicking on a result + Links []DataLink `json:"links,omitempty"` + + // Alternative to empty string + NoValue string `json:"noValue,omitempty"` + + // Panel Specific Values + Custom map[string]interface{} `json:"custom,omitempty"` +} + +// ConfFloat64 is a float64. It Marshals float64 values of NaN of Inf +// to null. +type ConfFloat64 float64 + +func (sf *ConfFloat64) MarshalJSON() ([]byte, error) { + if sf == nil || math.IsNaN(float64(*sf)) || math.IsInf(float64(*sf), -1) || math.IsInf(float64(*sf), 1) { + return []byte("null"), nil + } + + return []byte(fmt.Sprintf(`%v`, float64(*sf))), nil +} + +func (sf *ConfFloat64) UnmarshalJSON(data []byte) error { + s := string(data) + if s == "null" { + return nil + } + v, err := strconv.ParseFloat(s, 64) + if err != nil { + return err + } + cf := ConfFloat64(v) + *sf = cf + return nil +} + +// FieldConfigFromJSON create a FieldConfig from json string +func FieldConfigFromJSON(jsonStr string) (*FieldConfig, error) { + var cfg FieldConfig + err := json.Unmarshal([]byte(jsonStr), &cfg) + if err != nil { + return nil, err + } + return &cfg, nil +} + +// SetDecimals modifies the FieldConfig's Decimals property to +// be set to v and returns the FieldConfig. It is a convenance function +// since the Decimals property is a pointer. +func (fc *FieldConfig) SetDecimals(v uint16) *FieldConfig { + fc.Decimals = &v + return fc +} + +// SetMin modifies the FieldConfig's Min property to +// be set to v and returns the FieldConfig. It is a convenance function +// since the Min property is a pointer. +func (fc *FieldConfig) SetMin(v float64) *FieldConfig { + cf := ConfFloat64(v) + fc.Min = &cf + return fc +} + +// SetMax modifies the FieldConfig's Max property to +// be set to v and returns the FieldConfig. It is a convenance function +// since the Min property is a pointer. +func (fc *FieldConfig) SetMax(v float64) *FieldConfig { + cf := ConfFloat64(v) + fc.Max = &cf + return fc +} + +// SetFilterable modifies the FieldConfig's Filterable property to +// be set to b and returns the FieldConfig. It is a convenance function +// since the Filterable property is a pointer. +func (fc *FieldConfig) SetFilterable(b bool) *FieldConfig { + fc.Filterable = &b + return fc +} + +// NullValueMode say how the UI should show null values +type NullValueMode string + +const ( + // NullValueModeNull displays null values + NullValueModeNull NullValueMode = "null" + // NullValueModeIgnore sets the display to ignore null values + NullValueModeIgnore NullValueMode = "connected" + // NullValueModeAsZero set the display show null values as zero + NullValueModeAsZero NullValueMode = "null as zero" +) + +// MappingType value or range +type MappingType int8 + +const ( + // ValueToText map a value to text + ValueToText MappingType = iota + 1 + + // RangeToText map a range to text + RangeToText +) + +// ValueMapping convert input value to something else +type ValueMapping struct { + ID int16 `json:"id"` + Operator string `json:"operator"` + Text string `json:"title"` + Type MappingType `json:"type"` + + // Only valid for MappingType == ValueMap + Value string `json:"value,omitempty"` + + // Only valid for MappingType == RangeMap + From string `json:"from,omitempty"` + To string `json:"to,omitempty"` +} + +// DataLink define what +type DataLink struct { + Title string `json:"title,omitempty"` + TargetBlank bool `json:"targetBlank,omitempty"` + URL string `json:"url,omitempty"` +} + +// ThresholdsConfig setup thresholds +type ThresholdsConfig struct { + Mode ThresholdsMode `json:"mode"` + + // Must be sorted by 'value', first value is always -Infinity + Steps []Threshold `json:"steps"` +} + +// Threshold a single step on the threshold list +type Threshold struct { + Value ConfFloat64 `json:"value,omitempty"` // First value is always -Infinity serialize to null + Color string `json:"color,omitempty"` + State string `json:"state,omitempty"` +} + +// NewThreshold Creates a new Threshold object +func NewThreshold(value float64, color, state string) Threshold { + cf := ConfFloat64(value) + return Threshold{ + Value: cf, + Color: color, + State: state, + } +} + +// ThresholdsMode absolute or percentage +type ThresholdsMode string + +const ( + // ThresholdsModeAbsolute pick thresholds based on absolute value + ThresholdsModeAbsolute ThresholdsMode = "absolute" + + // ThresholdsModePercentage the threshold is relative to min/max + ThresholdsModePercentage ThresholdsMode = "percentage" +) diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/generic_nullable_vector.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/generic_nullable_vector.go new file mode 100644 index 00000000000..5502cef7e37 --- /dev/null +++ b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/generic_nullable_vector.go @@ -0,0 +1,34 @@ +// -build !test + +package dataframe + +//go:generate genny -in=$GOFILE -out=nullable_vector.gen.go gen "gen=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type nullablegenVector []*gen + +func newNullablegenVector(n int) *nullablegenVector { + v := nullablegenVector(make([]*gen, n)) + return &v +} + +func (v *nullablegenVector) Set(idx int, i interface{}) { + (*v)[idx] = i.(*gen) +} + +func (v *nullablegenVector) Append(i interface{}) { + (*v) = append((*v), i.(*gen)) +} + +func (v *nullablegenVector) At(i int) interface{} { + return (*v)[i] +} + +func (v *nullablegenVector) Len() int { + return len((*v)) +} + +func (v *nullablegenVector) PrimitiveType() VectorPType { + // following generates the right code but makes this invalid + //return VectorPTypeNullablegen + return vectorPType(v) +} diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/generic_vector.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/generic_vector.go new file mode 100644 index 00000000000..e109fa7c6d9 --- /dev/null +++ b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/generic_vector.go @@ -0,0 +1,36 @@ +package dataframe + +import ( + "github.com/cheekybits/genny/generic" +) + +//go:generate genny -in=$GOFILE -out=vector.gen.go gen "gen=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type gen generic.Type + +type genVector []gen + +func newgenVector(n int) *genVector { + v := genVector(make([]gen, n)) + return &v +} + +func (v *genVector) Set(idx int, i interface{}) { + (*v)[idx] = i.(gen) +} + +func (v *genVector) Append(i interface{}) { + (*v) = append((*v), i.(gen)) +} + +func (v *genVector) At(i int) interface{} { + return (*v)[i] +} + +func (v *genVector) Len() int { + return len((*v)) +} + +func (v *genVector) PrimitiveType() VectorPType { + return vectorPType(v) +} diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/nullable_vector.gen.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/nullable_vector.gen.go new file mode 100644 index 00000000000..13dc5836f27 --- /dev/null +++ b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/nullable_vector.gen.go @@ -0,0 +1,436 @@ +// This file was automatically generated by genny. +// Any changes will be lost if this file is regenerated. +// see https://github.com/cheekybits/genny + +// -build !test + +package dataframe + +import "time" + +//go:Uint8erate uint8ny -in=$GOFILE -out=nullable_vector.Uint8.go uint8 "Uint8=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type nullableUint8Vector []*uint8 + +func newNullableUint8Vector(n int) *nullableUint8Vector { + v := nullableUint8Vector(make([]*uint8, n)) + return &v +} + +func (v *nullableUint8Vector) Set(idx int, i interface{}) { + (*v)[idx] = i.(*uint8) +} + +func (v *nullableUint8Vector) Append(i interface{}) { + (*v) = append((*v), i.(*uint8)) +} + +func (v *nullableUint8Vector) At(i int) interface{} { + return (*v)[i] +} + +func (v *nullableUint8Vector) Len() int { + return len((*v)) +} + +func (v *nullableUint8Vector) PrimitiveType() VectorPType { + // following uint8erates the right code but makes this invalid + //return VectorPTypeNullableUint8 + return vectorPType(v) +} + +// -build !test + +//go:Uint16erate uint16ny -in=$GOFILE -out=nullable_vector.Uint16.go uint16 "Uint16=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type nullableUint16Vector []*uint16 + +func newNullableUint16Vector(n int) *nullableUint16Vector { + v := nullableUint16Vector(make([]*uint16, n)) + return &v +} + +func (v *nullableUint16Vector) Set(idx int, i interface{}) { + (*v)[idx] = i.(*uint16) +} + +func (v *nullableUint16Vector) Append(i interface{}) { + (*v) = append((*v), i.(*uint16)) +} + +func (v *nullableUint16Vector) At(i int) interface{} { + return (*v)[i] +} + +func (v *nullableUint16Vector) Len() int { + return len((*v)) +} + +func (v *nullableUint16Vector) PrimitiveType() VectorPType { + // following uint16erates the right code but makes this invalid + //return VectorPTypeNullableUint16 + return vectorPType(v) +} + +// -build !test + +//go:Uint32erate uint32ny -in=$GOFILE -out=nullable_vector.Uint32.go uint32 "Uint32=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type nullableUint32Vector []*uint32 + +func newNullableUint32Vector(n int) *nullableUint32Vector { + v := nullableUint32Vector(make([]*uint32, n)) + return &v +} + +func (v *nullableUint32Vector) Set(idx int, i interface{}) { + (*v)[idx] = i.(*uint32) +} + +func (v *nullableUint32Vector) Append(i interface{}) { + (*v) = append((*v), i.(*uint32)) +} + +func (v *nullableUint32Vector) At(i int) interface{} { + return (*v)[i] +} + +func (v *nullableUint32Vector) Len() int { + return len((*v)) +} + +func (v *nullableUint32Vector) PrimitiveType() VectorPType { + // following uint32erates the right code but makes this invalid + //return VectorPTypeNullableUint32 + return vectorPType(v) +} + +// -build !test + +//go:Uint64erate uint64ny -in=$GOFILE -out=nullable_vector.Uint64.go uint64 "Uint64=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type nullableUint64Vector []*uint64 + +func newNullableUint64Vector(n int) *nullableUint64Vector { + v := nullableUint64Vector(make([]*uint64, n)) + return &v +} + +func (v *nullableUint64Vector) Set(idx int, i interface{}) { + (*v)[idx] = i.(*uint64) +} + +func (v *nullableUint64Vector) Append(i interface{}) { + (*v) = append((*v), i.(*uint64)) +} + +func (v *nullableUint64Vector) At(i int) interface{} { + return (*v)[i] +} + +func (v *nullableUint64Vector) Len() int { + return len((*v)) +} + +func (v *nullableUint64Vector) PrimitiveType() VectorPType { + // following uint64erates the right code but makes this invalid + //return VectorPTypeNullableUint64 + return vectorPType(v) +} + +// -build !test + +//go:Int8erate int8ny -in=$GOFILE -out=nullable_vector.Int8.go int8 "Int8=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type nullableInt8Vector []*int8 + +func newNullableInt8Vector(n int) *nullableInt8Vector { + v := nullableInt8Vector(make([]*int8, n)) + return &v +} + +func (v *nullableInt8Vector) Set(idx int, i interface{}) { + (*v)[idx] = i.(*int8) +} + +func (v *nullableInt8Vector) Append(i interface{}) { + (*v) = append((*v), i.(*int8)) +} + +func (v *nullableInt8Vector) At(i int) interface{} { + return (*v)[i] +} + +func (v *nullableInt8Vector) Len() int { + return len((*v)) +} + +func (v *nullableInt8Vector) PrimitiveType() VectorPType { + // following int8erates the right code but makes this invalid + //return VectorPTypeNullableInt8 + return vectorPType(v) +} + +// -build !test + +//go:Int16erate int16ny -in=$GOFILE -out=nullable_vector.Int16.go int16 "Int16=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type nullableInt16Vector []*int16 + +func newNullableInt16Vector(n int) *nullableInt16Vector { + v := nullableInt16Vector(make([]*int16, n)) + return &v +} + +func (v *nullableInt16Vector) Set(idx int, i interface{}) { + (*v)[idx] = i.(*int16) +} + +func (v *nullableInt16Vector) Append(i interface{}) { + (*v) = append((*v), i.(*int16)) +} + +func (v *nullableInt16Vector) At(i int) interface{} { + return (*v)[i] +} + +func (v *nullableInt16Vector) Len() int { + return len((*v)) +} + +func (v *nullableInt16Vector) PrimitiveType() VectorPType { + // following int16erates the right code but makes this invalid + //return VectorPTypeNullableInt16 + return vectorPType(v) +} + +// -build !test + +//go:Int32erate int32ny -in=$GOFILE -out=nullable_vector.Int32.go int32 "Int32=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type nullableInt32Vector []*int32 + +func newNullableInt32Vector(n int) *nullableInt32Vector { + v := nullableInt32Vector(make([]*int32, n)) + return &v +} + +func (v *nullableInt32Vector) Set(idx int, i interface{}) { + (*v)[idx] = i.(*int32) +} + +func (v *nullableInt32Vector) Append(i interface{}) { + (*v) = append((*v), i.(*int32)) +} + +func (v *nullableInt32Vector) At(i int) interface{} { + return (*v)[i] +} + +func (v *nullableInt32Vector) Len() int { + return len((*v)) +} + +func (v *nullableInt32Vector) PrimitiveType() VectorPType { + // following int32erates the right code but makes this invalid + //return VectorPTypeNullableInt32 + return vectorPType(v) +} + +// -build !test + +//go:Int64erate int64ny -in=$GOFILE -out=nullable_vector.Int64.go int64 "Int64=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type nullableInt64Vector []*int64 + +func newNullableInt64Vector(n int) *nullableInt64Vector { + v := nullableInt64Vector(make([]*int64, n)) + return &v +} + +func (v *nullableInt64Vector) Set(idx int, i interface{}) { + (*v)[idx] = i.(*int64) +} + +func (v *nullableInt64Vector) Append(i interface{}) { + (*v) = append((*v), i.(*int64)) +} + +func (v *nullableInt64Vector) At(i int) interface{} { + return (*v)[i] +} + +func (v *nullableInt64Vector) Len() int { + return len((*v)) +} + +func (v *nullableInt64Vector) PrimitiveType() VectorPType { + // following int64erates the right code but makes this invalid + //return VectorPTypeNullableInt64 + return vectorPType(v) +} + +// -build !test + +//go:Float32erate float32ny -in=$GOFILE -out=nullable_vector.Float32.go float32 "Float32=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type nullableFloat32Vector []*float32 + +func newNullableFloat32Vector(n int) *nullableFloat32Vector { + v := nullableFloat32Vector(make([]*float32, n)) + return &v +} + +func (v *nullableFloat32Vector) Set(idx int, i interface{}) { + (*v)[idx] = i.(*float32) +} + +func (v *nullableFloat32Vector) Append(i interface{}) { + (*v) = append((*v), i.(*float32)) +} + +func (v *nullableFloat32Vector) At(i int) interface{} { + return (*v)[i] +} + +func (v *nullableFloat32Vector) Len() int { + return len((*v)) +} + +func (v *nullableFloat32Vector) PrimitiveType() VectorPType { + // following float32erates the right code but makes this invalid + //return VectorPTypeNullableFloat32 + return vectorPType(v) +} + +// -build !test + +//go:Float64erate float64ny -in=$GOFILE -out=nullable_vector.Float64.go float64 "Float64=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type nullableFloat64Vector []*float64 + +func newNullableFloat64Vector(n int) *nullableFloat64Vector { + v := nullableFloat64Vector(make([]*float64, n)) + return &v +} + +func (v *nullableFloat64Vector) Set(idx int, i interface{}) { + (*v)[idx] = i.(*float64) +} + +func (v *nullableFloat64Vector) Append(i interface{}) { + (*v) = append((*v), i.(*float64)) +} + +func (v *nullableFloat64Vector) At(i int) interface{} { + return (*v)[i] +} + +func (v *nullableFloat64Vector) Len() int { + return len((*v)) +} + +func (v *nullableFloat64Vector) PrimitiveType() VectorPType { + // following float64erates the right code but makes this invalid + //return VectorPTypeNullableFloat64 + return vectorPType(v) +} + +// -build !test + +//go:Stringerate stringny -in=$GOFILE -out=nullable_vector.String.go string "String=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type nullableStringVector []*string + +func newNullableStringVector(n int) *nullableStringVector { + v := nullableStringVector(make([]*string, n)) + return &v +} + +func (v *nullableStringVector) Set(idx int, i interface{}) { + (*v)[idx] = i.(*string) +} + +func (v *nullableStringVector) Append(i interface{}) { + (*v) = append((*v), i.(*string)) +} + +func (v *nullableStringVector) At(i int) interface{} { + return (*v)[i] +} + +func (v *nullableStringVector) Len() int { + return len((*v)) +} + +func (v *nullableStringVector) PrimitiveType() VectorPType { + // following stringerates the right code but makes this invalid + //return VectorPTypeNullableString + return vectorPType(v) +} + +// -build !test + +//go:Boolerate boolny -in=$GOFILE -out=nullable_vector.Bool.go bool "Bool=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type nullableBoolVector []*bool + +func newNullableBoolVector(n int) *nullableBoolVector { + v := nullableBoolVector(make([]*bool, n)) + return &v +} + +func (v *nullableBoolVector) Set(idx int, i interface{}) { + (*v)[idx] = i.(*bool) +} + +func (v *nullableBoolVector) Append(i interface{}) { + (*v) = append((*v), i.(*bool)) +} + +func (v *nullableBoolVector) At(i int) interface{} { + return (*v)[i] +} + +func (v *nullableBoolVector) Len() int { + return len((*v)) +} + +func (v *nullableBoolVector) PrimitiveType() VectorPType { + // following boolerates the right code but makes this invalid + //return VectorPTypeNullableBool + return vectorPType(v) +} + +// -build !test + +//go:TimeTimeerate timeTimeny -in=$GOFILE -out=nullable_vector.TimeTime.go time.Time "TimeTime=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type nullableTimeTimeVector []*time.Time + +func newNullableTimeTimeVector(n int) *nullableTimeTimeVector { + v := nullableTimeTimeVector(make([]*time.Time, n)) + return &v +} + +func (v *nullableTimeTimeVector) Set(idx int, i interface{}) { + (*v)[idx] = i.(*time.Time) +} + +func (v *nullableTimeTimeVector) Append(i interface{}) { + (*v) = append((*v), i.(*time.Time)) +} + +func (v *nullableTimeTimeVector) At(i int) interface{} { + return (*v)[i] +} + +func (v *nullableTimeTimeVector) Len() int { + return len((*v)) +} + +func (v *nullableTimeTimeVector) PrimitiveType() VectorPType { + // following timeTimeerates the right code but makes this invalid + //return VectorPTypeNullableTimeTime + return vectorPType(v) +} diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/query_result_meta.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/query_result_meta.go new file mode 100644 index 00000000000..7797dae1e93 --- /dev/null +++ b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/query_result_meta.go @@ -0,0 +1,28 @@ +package dataframe + +import "encoding/json" + +// QueryResultMeta matches: +// https://github.com/grafana/grafana/blob/master/packages/grafana-data/src/types/data.ts#L11 +// NOTE -- in javascript this can accept any `[key: string]: any;` however +// this interface only exposes the values we want to be exposed +type QueryResultMeta struct { + // Used in Explore for highlighting + SearchWords []string `json:"searchWords,omitempty"` + + // Used in Explore to show limit applied to search result + Limit int64 `json:"limit,omitempty"` + + // Datasource specific values + Custom map[string]interface{} `json:"custom,omitempty"` +} + +// QueryResultMetaFromJSON creates a QueryResultMeta from a json string +func QueryResultMetaFromJSON(jsonStr string) (*QueryResultMeta, error) { + var m QueryResultMeta + err := json.Unmarshal([]byte(jsonStr), &m) + if err != nil { + return nil, err + } + return &m, nil +} diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector.gen.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector.gen.go new file mode 100644 index 00000000000..f52b7d45361 --- /dev/null +++ b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector.gen.go @@ -0,0 +1,384 @@ +// This file was automatically generated by genny. +// Any changes will be lost if this file is regenerated. +// see https://github.com/cheekybits/genny + +package dataframe + +import "time" + +//go:Uint8erate uint8ny -in=$GOFILE -out=vector.Uint8.go uint8 "Uint8=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type uint8Vector []uint8 + +func newUint8Vector(n int) *uint8Vector { + v := uint8Vector(make([]uint8, n)) + return &v +} + +func (v *uint8Vector) Set(idx int, i interface{}) { + (*v)[idx] = i.(uint8) +} + +func (v *uint8Vector) Append(i interface{}) { + (*v) = append((*v), i.(uint8)) +} + +func (v *uint8Vector) At(i int) interface{} { + return (*v)[i] +} + +func (v *uint8Vector) Len() int { + return len((*v)) +} + +func (v *uint8Vector) PrimitiveType() VectorPType { + return vectorPType(v) +} + +//go:Uint16erate uint16ny -in=$GOFILE -out=vector.Uint16.go uint16 "Uint16=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type uint16Vector []uint16 + +func newUint16Vector(n int) *uint16Vector { + v := uint16Vector(make([]uint16, n)) + return &v +} + +func (v *uint16Vector) Set(idx int, i interface{}) { + (*v)[idx] = i.(uint16) +} + +func (v *uint16Vector) Append(i interface{}) { + (*v) = append((*v), i.(uint16)) +} + +func (v *uint16Vector) At(i int) interface{} { + return (*v)[i] +} + +func (v *uint16Vector) Len() int { + return len((*v)) +} + +func (v *uint16Vector) PrimitiveType() VectorPType { + return vectorPType(v) +} + +//go:Uint32erate uint32ny -in=$GOFILE -out=vector.Uint32.go uint32 "Uint32=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type uint32Vector []uint32 + +func newUint32Vector(n int) *uint32Vector { + v := uint32Vector(make([]uint32, n)) + return &v +} + +func (v *uint32Vector) Set(idx int, i interface{}) { + (*v)[idx] = i.(uint32) +} + +func (v *uint32Vector) Append(i interface{}) { + (*v) = append((*v), i.(uint32)) +} + +func (v *uint32Vector) At(i int) interface{} { + return (*v)[i] +} + +func (v *uint32Vector) Len() int { + return len((*v)) +} + +func (v *uint32Vector) PrimitiveType() VectorPType { + return vectorPType(v) +} + +//go:Uint64erate uint64ny -in=$GOFILE -out=vector.Uint64.go uint64 "Uint64=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type uint64Vector []uint64 + +func newUint64Vector(n int) *uint64Vector { + v := uint64Vector(make([]uint64, n)) + return &v +} + +func (v *uint64Vector) Set(idx int, i interface{}) { + (*v)[idx] = i.(uint64) +} + +func (v *uint64Vector) Append(i interface{}) { + (*v) = append((*v), i.(uint64)) +} + +func (v *uint64Vector) At(i int) interface{} { + return (*v)[i] +} + +func (v *uint64Vector) Len() int { + return len((*v)) +} + +func (v *uint64Vector) PrimitiveType() VectorPType { + return vectorPType(v) +} + +//go:Int8erate int8ny -in=$GOFILE -out=vector.Int8.go int8 "Int8=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type int8Vector []int8 + +func newInt8Vector(n int) *int8Vector { + v := int8Vector(make([]int8, n)) + return &v +} + +func (v *int8Vector) Set(idx int, i interface{}) { + (*v)[idx] = i.(int8) +} + +func (v *int8Vector) Append(i interface{}) { + (*v) = append((*v), i.(int8)) +} + +func (v *int8Vector) At(i int) interface{} { + return (*v)[i] +} + +func (v *int8Vector) Len() int { + return len((*v)) +} + +func (v *int8Vector) PrimitiveType() VectorPType { + return vectorPType(v) +} + +//go:Int16erate int16ny -in=$GOFILE -out=vector.Int16.go int16 "Int16=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type int16Vector []int16 + +func newInt16Vector(n int) *int16Vector { + v := int16Vector(make([]int16, n)) + return &v +} + +func (v *int16Vector) Set(idx int, i interface{}) { + (*v)[idx] = i.(int16) +} + +func (v *int16Vector) Append(i interface{}) { + (*v) = append((*v), i.(int16)) +} + +func (v *int16Vector) At(i int) interface{} { + return (*v)[i] +} + +func (v *int16Vector) Len() int { + return len((*v)) +} + +func (v *int16Vector) PrimitiveType() VectorPType { + return vectorPType(v) +} + +//go:Int32erate int32ny -in=$GOFILE -out=vector.Int32.go int32 "Int32=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type int32Vector []int32 + +func newInt32Vector(n int) *int32Vector { + v := int32Vector(make([]int32, n)) + return &v +} + +func (v *int32Vector) Set(idx int, i interface{}) { + (*v)[idx] = i.(int32) +} + +func (v *int32Vector) Append(i interface{}) { + (*v) = append((*v), i.(int32)) +} + +func (v *int32Vector) At(i int) interface{} { + return (*v)[i] +} + +func (v *int32Vector) Len() int { + return len((*v)) +} + +func (v *int32Vector) PrimitiveType() VectorPType { + return vectorPType(v) +} + +//go:Int64erate int64ny -in=$GOFILE -out=vector.Int64.go int64 "Int64=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type int64Vector []int64 + +func newInt64Vector(n int) *int64Vector { + v := int64Vector(make([]int64, n)) + return &v +} + +func (v *int64Vector) Set(idx int, i interface{}) { + (*v)[idx] = i.(int64) +} + +func (v *int64Vector) Append(i interface{}) { + (*v) = append((*v), i.(int64)) +} + +func (v *int64Vector) At(i int) interface{} { + return (*v)[i] +} + +func (v *int64Vector) Len() int { + return len((*v)) +} + +func (v *int64Vector) PrimitiveType() VectorPType { + return vectorPType(v) +} + +//go:Float32erate float32ny -in=$GOFILE -out=vector.Float32.go float32 "Float32=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type float32Vector []float32 + +func newFloat32Vector(n int) *float32Vector { + v := float32Vector(make([]float32, n)) + return &v +} + +func (v *float32Vector) Set(idx int, i interface{}) { + (*v)[idx] = i.(float32) +} + +func (v *float32Vector) Append(i interface{}) { + (*v) = append((*v), i.(float32)) +} + +func (v *float32Vector) At(i int) interface{} { + return (*v)[i] +} + +func (v *float32Vector) Len() int { + return len((*v)) +} + +func (v *float32Vector) PrimitiveType() VectorPType { + return vectorPType(v) +} + +//go:Float64erate float64ny -in=$GOFILE -out=vector.Float64.go float64 "Float64=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type float64Vector []float64 + +func newFloat64Vector(n int) *float64Vector { + v := float64Vector(make([]float64, n)) + return &v +} + +func (v *float64Vector) Set(idx int, i interface{}) { + (*v)[idx] = i.(float64) +} + +func (v *float64Vector) Append(i interface{}) { + (*v) = append((*v), i.(float64)) +} + +func (v *float64Vector) At(i int) interface{} { + return (*v)[i] +} + +func (v *float64Vector) Len() int { + return len((*v)) +} + +func (v *float64Vector) PrimitiveType() VectorPType { + return vectorPType(v) +} + +//go:Stringerate stringny -in=$GOFILE -out=vector.String.go string "String=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type stringVector []string + +func newStringVector(n int) *stringVector { + v := stringVector(make([]string, n)) + return &v +} + +func (v *stringVector) Set(idx int, i interface{}) { + (*v)[idx] = i.(string) +} + +func (v *stringVector) Append(i interface{}) { + (*v) = append((*v), i.(string)) +} + +func (v *stringVector) At(i int) interface{} { + return (*v)[i] +} + +func (v *stringVector) Len() int { + return len((*v)) +} + +func (v *stringVector) PrimitiveType() VectorPType { + return vectorPType(v) +} + +//go:Boolerate boolny -in=$GOFILE -out=vector.Bool.go bool "Bool=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type boolVector []bool + +func newBoolVector(n int) *boolVector { + v := boolVector(make([]bool, n)) + return &v +} + +func (v *boolVector) Set(idx int, i interface{}) { + (*v)[idx] = i.(bool) +} + +func (v *boolVector) Append(i interface{}) { + (*v) = append((*v), i.(bool)) +} + +func (v *boolVector) At(i int) interface{} { + return (*v)[i] +} + +func (v *boolVector) Len() int { + return len((*v)) +} + +func (v *boolVector) PrimitiveType() VectorPType { + return vectorPType(v) +} + +//go:TimeTimeerate timeTimeny -in=$GOFILE -out=vector.TimeTime.go time.Time "TimeTime=uint8,uint16,uint32,uint64,int8,int16,int32,int64,float32,float64,string,bool,time.Time" + +type timeTimeVector []time.Time + +func newTimeTimeVector(n int) *timeTimeVector { + v := timeTimeVector(make([]time.Time, n)) + return &v +} + +func (v *timeTimeVector) Set(idx int, i interface{}) { + (*v)[idx] = i.(time.Time) +} + +func (v *timeTimeVector) Append(i interface{}) { + (*v) = append((*v), i.(time.Time)) +} + +func (v *timeTimeVector) At(i int) interface{} { + return (*v)[i] +} + +func (v *timeTimeVector) Len() int { + return len((*v)) +} + +func (v *timeTimeVector) PrimitiveType() VectorPType { + return vectorPType(v) +} diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector.go index d6939872516..453436ba48a 100644 --- a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector.go +++ b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector.go @@ -12,22 +12,57 @@ type Vector interface { At(i int) interface{} Len() int PrimitiveType() VectorPType + //buildArrowColumn(pool memory.Allocator, field arrow.Field) *array.Column } func newVector(t interface{}, n int) (v Vector) { switch t.(type) { + // ints + case []int8: + v = newInt8Vector(n) + case []*int8: + v = newNullableInt8Vector(n) + case []int16: + v = newInt16Vector(n) + case []*int16: + v = newNullableInt16Vector(n) + case []int32: + v = newInt32Vector(n) + case []*int32: + v = newNullableInt32Vector(n) case []int64: - v = newIntVector(n) + v = newInt64Vector(n) case []*int64: - v = newNullableIntVector(n) + v = newNullableInt64Vector(n) + + // uints + case []uint8: + v = newUint8Vector(n) + case []*uint8: + v = newNullableUint8Vector(n) + case []uint16: + v = newUint16Vector(n) + case []*uint16: + v = newNullableUint16Vector(n) + case []uint32: + v = newUint32Vector(n) + case []*uint32: + v = newNullableUint32Vector(n) case []uint64: - v = newUintVector(n) + v = newUint64Vector(n) case []*uint64: - v = newNullableUintVector(n) + v = newNullableUint64Vector(n) + + // floats + case []float32: + v = newFloat32Vector(n) + case []*float32: + v = newNullableFloat32Vector(n) case []float64: - v = newFloatVector(n) + v = newFloat64Vector(n) case []*float64: - v = newNullableFloatVector(n) + v = newNullableFloat64Vector(n) + case []string: v = newStringVector(n) case []*string: @@ -37,9 +72,9 @@ func newVector(t interface{}, n int) (v Vector) { case []*bool: v = newNullableBoolVector(n) case []time.Time: - v = newTimeVector(n) + v = newTimeTimeVector(n) case []*time.Time: - v = newNullableTimeVector(n) + v = newNullableTimeTimeVector(n) default: panic(fmt.Sprintf("unsupported vector type of %T", t)) } @@ -50,15 +85,50 @@ func newVector(t interface{}, n int) (v Vector) { type VectorPType int const ( + // VectorPTypeInt8 indicates the underlying primitive is a []int8. + VectorPTypeInt8 VectorPType = iota + // VectorPTypeNullableInt8 indicates the underlying primitive is a []*int8. + VectorPTypeNullableInt8 + + // VectorPTypeInt16 indicates the underlying primitive is a []Int16. + VectorPTypeInt16 + // VectorPTypeNullableInt16 indicates the underlying primitive is a []*Int16. + VectorPTypeNullableInt16 + + // VectorPTypeInt32 indicates the underlying primitive is a []int32. + VectorPTypeInt32 + // VectorPTypeNullableInt32 indicates the underlying primitive is a []*int32. + VectorPTypeNullableInt32 + // VectorPTypeInt64 indicates the underlying primitive is a []int64. - VectorPTypeInt64 VectorPType = iota + VectorPTypeInt64 // VectorPTypeNullableInt64 indicates the underlying primitive is a []*int64. VectorPTypeNullableInt64 + // VectorPTypeUint8 indicates the underlying primitive is a []int8. + VectorPTypeUint8 + // VectorPTypeNullableUint8 indicates the underlying primitive is a []*int8. + VectorPTypeNullableUint8 + + // VectorPTypeUint16 indicates the underlying primitive is a []uint16. + VectorPTypeUint16 + // VectorPTypeNullableUint16 indicates the underlying primitive is a []*uint16. + VectorPTypeNullableUint16 + + // VectorPTypeUint32 indicates the underlying primitive is a []uint32. + VectorPTypeUint32 + // VectorPTypeNullableUint32 indicates the underlying primitive is a []*uint32. + VectorPTypeNullableUint32 + // VectorPTypeUint64 indicates the underlying primitive is a []uint64. VectorPTypeUint64 - // VectorPTypeNullableUInt64 indicates the underlying primitive is a []*uint64. - VectorPTypeNullableUInt64 + // VectorPTypeNullableUint64 indicates the underlying primitive is a []*uint64. + VectorPTypeNullableUint64 + + // VectorPTypeFloat32 indicates the underlying primitive is a []float32. + VectorPTypeFloat32 + // VectorPTypeNullableFloat32 indicates the underlying primitive is a []*float32. + VectorPTypeNullableFloat32 // VectorPTypeFloat64 indicates the underlying primitive is a []float64. VectorPTypeFloat64 @@ -80,3 +150,74 @@ const ( // VectorPTypeNullableTime indicates the underlying primitive is a []*time.Time. VectorPTypeNullableTime ) + +func vectorPType(v Vector) VectorPType { + switch v.(type) { + case *int8Vector: + return VectorPTypeInt8 + case *nullableInt8Vector: + return VectorPTypeNullableInt8 + + case *int16Vector: + return VectorPTypeInt16 + case *nullableInt16Vector: + return VectorPTypeNullableInt16 + + case *int32Vector: + return VectorPTypeInt32 + case *nullableInt32Vector: + return VectorPTypeNullableInt32 + + case *int64Vector: + return VectorPTypeInt64 + case *nullableInt64Vector: + return VectorPTypeNullableInt64 + + case *uint8Vector: + return VectorPTypeUint8 + case *nullableUint8Vector: + return VectorPTypeNullableUint8 + + case *uint16Vector: + return VectorPTypeUint16 + case *nullableUint16Vector: + return VectorPTypeNullableUint16 + + case *uint32Vector: + return VectorPTypeUint32 + case *nullableUint32Vector: + return VectorPTypeNullableUint32 + + case *uint64Vector: + return VectorPTypeUint64 + case *nullableUint64Vector: + return VectorPTypeNullableUint64 + + case *float32Vector: + return VectorPTypeFloat32 + case *nullableFloat32Vector: + return VectorPTypeNullableFloat32 + + case *float64Vector: + return VectorPTypeFloat64 + case *nullableFloat64Vector: + return VectorPTypeNullableFloat64 + + case *stringVector: + return VectorPTypeString + case *nullableStringVector: + return VectorPTypeNullableString + + case *boolVector: + return VectorPTypeBool + case *nullableBoolVector: + return VectorPTypeNullableBool + + case *timeTimeVector: + return VectorPTypeTime + case *nullableTimeTimeVector: + return VectorPTypeNullableTime + } + + return VectorPType(-1) +} diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_bool.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_bool.go deleted file mode 100644 index 44da59864fb..00000000000 --- a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_bool.go +++ /dev/null @@ -1,28 +0,0 @@ -package dataframe - -type boolVector []bool - -func newBoolVector(l int) *boolVector { - v := make(boolVector, l) - return &v -} - -func (v *boolVector) Set(i int, val interface{}) { - (*v)[i] = val.(bool) -} - -func (v *boolVector) Append(val interface{}) { - *v = append(*v, val.(bool)) -} - -func (v *boolVector) At(i int) interface{} { - return (*v)[i] -} - -func (v *boolVector) Len() int { - return len(*v) -} - -func (v *boolVector) PrimitiveType() VectorPType { - return VectorPTypeBool -} \ No newline at end of file diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_bool_nullable.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_bool_nullable.go deleted file mode 100644 index 0b805cad2ca..00000000000 --- a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_bool_nullable.go +++ /dev/null @@ -1,28 +0,0 @@ -package dataframe - -type nullableBoolVector []*bool - -func newNullableBoolVector(l int) *nullableBoolVector { - v := make(nullableBoolVector, l) - return &v -} - -func (v *nullableBoolVector) Set(i int, val interface{}) { - (*v)[i] = val.(*bool) -} - -func (v *nullableBoolVector) Append(val interface{}) { - *v = append(*v, val.(*bool)) -} - -func (v *nullableBoolVector) At(i int) interface{} { - return (*v)[i] -} - -func (v *nullableBoolVector) Len() int { - return len(*v) -} - -func (v *nullableBoolVector) PrimitiveType() VectorPType { - return VectorPTypeNullableBool -} diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_float.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_float.go deleted file mode 100644 index 356580f55a2..00000000000 --- a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_float.go +++ /dev/null @@ -1,28 +0,0 @@ -package dataframe - -type floatVector []float64 - -func newFloatVector(l int) *floatVector { - v := make(floatVector, l) - return &v -} - -func (v *floatVector) Set(i int, val interface{}) { - (*v)[i] = val.(float64) -} - -func (v *floatVector) Append(val interface{}) { - *v = append(*v, val.(float64)) -} - -func (v *floatVector) At(i int) interface{} { - return (*v)[i] -} - -func (v *floatVector) Len() int { - return len(*v) -} - -func (v *floatVector) PrimitiveType() VectorPType { - return VectorPTypeFloat64 -} diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_float_nullable.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_float_nullable.go deleted file mode 100644 index 645466c6265..00000000000 --- a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_float_nullable.go +++ /dev/null @@ -1,24 +0,0 @@ -package dataframe - -type nullableFloatVector []*float64 - -func newNullableFloatVector(l int) *nullableFloatVector { - v := make(nullableFloatVector, l) - return &v -} - -func (v *nullableFloatVector) Set(i int, val interface{}) { - (*v)[i] = val.(*float64) -} - -func (v *nullableFloatVector) Append(val interface{}) { - *v = append(*v, val.(*float64)) -} - -func (v *nullableFloatVector) At(i int) interface{} { return (*v)[i] } - -func (v *nullableFloatVector) Len() int { return len(*v) } - -func (v *nullableFloatVector) PrimitiveType() VectorPType { - return VectorPTypeNullableFloat64 -} diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_int.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_int.go deleted file mode 100644 index cb1ff5ad011..00000000000 --- a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_int.go +++ /dev/null @@ -1,28 +0,0 @@ -package dataframe - -type intVector []int64 - -func newIntVector(l int) *intVector { - v := make(intVector, l) - return &v -} - -func (v *intVector) Set(i int, val interface{}) { - (*v)[i] = val.(int64) -} - -func (v *intVector) Append(val interface{}) { - *v = append(*v, val.(int64)) -} - -func (v *intVector) At(i int) interface{} { - return (*v)[i] -} - -func (v *intVector) Len() int { - return len(*v) -} - -func (v *intVector) PrimitiveType() VectorPType { - return VectorPTypeInt64 -} diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_int_nullable.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_int_nullable.go deleted file mode 100644 index 8db9957f11a..00000000000 --- a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_int_nullable.go +++ /dev/null @@ -1,24 +0,0 @@ -package dataframe - -type nullableIntVector []*int64 - -func newNullableIntVector(l int) *nullableIntVector { - v := make(nullableIntVector, l) - return &v -} - -func (v *nullableIntVector) Set(i int, val interface{}) { - (*v)[i] = val.(*int64) -} - -func (v *nullableIntVector) Append(val interface{}) { - *v = append(*v, val.(*int64)) -} - -func (v *nullableIntVector) At(i int) interface{} { return (*v)[i] } - -func (v *nullableIntVector) Len() int { return len(*v) } - -func (v *nullableIntVector) PrimitiveType() VectorPType { - return VectorPTypeNullableInt64 -} diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_string.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_string.go deleted file mode 100644 index 76c544444c4..00000000000 --- a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_string.go +++ /dev/null @@ -1,28 +0,0 @@ -package dataframe - -type stringVector []string - -func newStringVector(l int) *stringVector { - v := make(stringVector, l) - return &v -} - -func (v *stringVector) Set(i int, val interface{}) { - (*v)[i] = val.(string) -} - -func (v *stringVector) Append(val interface{}) { - *v = append(*v, val.(string)) -} - -func (v *stringVector) At(i int) interface{} { - return (*v)[i] -} - -func (v *stringVector) Len() int { - return len(*v) -} - -func (v *stringVector) PrimitiveType() VectorPType { - return VectorPTypeString -} \ No newline at end of file diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_string_nullable.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_string_nullable.go deleted file mode 100644 index 383541dec3b..00000000000 --- a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_string_nullable.go +++ /dev/null @@ -1,28 +0,0 @@ -package dataframe - -type nullableStringVector []*string - -func newNullableStringVector(l int) *nullableStringVector { - v := make(nullableStringVector, l) - return &v -} - -func (v *nullableStringVector) Set(i int, val interface{}) { - (*v)[i] = val.(*string) -} - -func (v *nullableStringVector) Append(val interface{}) { - *v = append(*v, val.(*string)) -} - -func (v *nullableStringVector) At(i int) interface{} { - return (*v)[i] -} - -func (v *nullableStringVector) Len() int { - return len(*v) -} - -func (v *nullableStringVector) PrimitiveType() VectorPType { - return VectorPTypeNullableString -} \ No newline at end of file diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_time.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_time.go deleted file mode 100644 index 7f89ad42f91..00000000000 --- a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_time.go +++ /dev/null @@ -1,32 +0,0 @@ -package dataframe - -import ( - "time" -) - -type timeVector []time.Time - -func newTimeVector(l int) *timeVector { - v := make(timeVector, l) - return &v -} - -func (v *timeVector) Set(i int, val interface{}) { - (*v)[i] = val.(time.Time) -} - -func (v *timeVector) Append(val interface{}) { - *v = append(*v, val.(time.Time)) -} - -func (v *timeVector) At(i int) interface{} { - return (*v)[i] -} - -func (v *timeVector) Len() int { - return len(*v) -} - -func (v *timeVector) PrimitiveType() VectorPType { - return VectorPTypeTime -} \ No newline at end of file diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_time_nullable.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_time_nullable.go deleted file mode 100644 index 2d4e3354e62..00000000000 --- a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_time_nullable.go +++ /dev/null @@ -1,32 +0,0 @@ -package dataframe - -import ( - "time" -) - -type nullableTimeVector []*time.Time - -func newNullableTimeVector(l int) *nullableTimeVector { - v := make(nullableTimeVector, l) - return &v -} - -func (v *nullableTimeVector) Set(i int, val interface{}) { - (*v)[i] = val.(*time.Time) -} - -func (v *nullableTimeVector) Append(val interface{}) { - *v = append(*v, val.(*time.Time)) -} - -func (v *nullableTimeVector) At(i int) interface{} { - return (*v)[i] -} - -func (v *nullableTimeVector) Len() int { - return len(*v) -} - -func (v *nullableTimeVector) PrimitiveType() VectorPType { - return VectorPTypeNullableTime -} diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_uint.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_uint.go deleted file mode 100644 index 0af664640df..00000000000 --- a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_uint.go +++ /dev/null @@ -1,28 +0,0 @@ -package dataframe - -type uintVector []uint64 - -func newUintVector(l int) *uintVector { - v := make(uintVector, l) - return &v -} - -func (v *uintVector) Set(i int, val interface{}) { - (*v)[i] = val.(uint64) -} - -func (v *uintVector) Append(val interface{}) { - *v = append(*v, val.(uint64)) -} - -func (v *uintVector) At(i int) interface{} { - return (*v)[i] -} - -func (v *uintVector) Len() int { - return len(*v) -} - -func (v *uintVector) PrimitiveType() VectorPType { - return VectorPTypeUint64 -} diff --git a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_uint_nullable.go b/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_uint_nullable.go deleted file mode 100644 index fa88268f5c5..00000000000 --- a/vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector_uint_nullable.go +++ /dev/null @@ -1,24 +0,0 @@ -package dataframe - -type nullableUintVector []*uint64 - -func newNullableUintVector(l int) *nullableUintVector { - v := make(nullableUintVector, l) - return &v -} - -func (v *nullableUintVector) Set(i int, val interface{}) { - (*v)[i] = val.(*uint64) -} - -func (v *nullableUintVector) Append(val interface{}) { - *v = append(*v, val.(*uint64)) -} - -func (v *nullableUintVector) At(i int) interface{} { return (*v)[i] } - -func (v *nullableUintVector) Len() int { return len(*v) } - -func (v *nullableUintVector) PrimitiveType() VectorPType { - return VectorPTypeNullableUInt64 -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 8be0eebc9d7..bbd8c73b970 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -5,7 +5,7 @@ cloud.google.com/go/compute/metadata github.com/BurntSushi/toml # github.com/VividCortex/mysqlerr v0.0.0-20170204212430-6c6b55f8796f github.com/VividCortex/mysqlerr -# github.com/apache/arrow/go/arrow v0.0.0-20190716210558-5f564424c71c +# github.com/apache/arrow/go/arrow v0.0.0-20191025121910-b789226ccb21 github.com/apache/arrow/go/arrow github.com/apache/arrow/go/arrow/array github.com/apache/arrow/go/arrow/arrio @@ -76,6 +76,8 @@ github.com/beorn7/perks/quantile github.com/bradfitz/gomemcache/memcache # github.com/cespare/xxhash/v2 v2.1.1 github.com/cespare/xxhash/v2 +# github.com/cheekybits/genny v1.0.0 +github.com/cheekybits/genny/generic # github.com/codegangsta/cli v1.20.0 github.com/codegangsta/cli # github.com/crewjam/saml v0.0.0-20191031171751-c42136edf9b1 @@ -140,7 +142,7 @@ github.com/gosimple/slug # github.com/grafana/grafana-plugin-model v0.0.0-20190930120109-1fc953a61fb4 github.com/grafana/grafana-plugin-model/go/datasource github.com/grafana/grafana-plugin-model/go/renderer -# github.com/grafana/grafana-plugin-sdk-go v0.6.0 +# github.com/grafana/grafana-plugin-sdk-go v0.11.0 github.com/grafana/grafana-plugin-sdk-go/backend github.com/grafana/grafana-plugin-sdk-go/dataframe github.com/grafana/grafana-plugin-sdk-go/genproto/pluginv2