Files
grafana/pkg/services/store/entity/sqlstash/sqltemplate/into.go
T
Diego Augusto Molina cbcd945251 Unified Storage: in SQL template, also handle output data, improve API, examples and docs (#87560)
* preview of work so far

* stylistic improvements

* fix linters

* remove golden tests, they may cause the system to be too rigid to changes

* remove unnecessary code for golden tests

* remove white space mangling in Execute

* also handle output data, improve API, examples and docs

* add helper methods

* fix interface
2024-05-14 12:32:21 -03:00

23 lines
406 B
Go

package sqltemplate
import (
"fmt"
"reflect"
)
type ScanDest []any
func (i *ScanDest) Into(v reflect.Value, colName string) (string, error) {
if !v.IsValid() || !v.CanAddr() || !v.Addr().CanInterface() {
return "", fmt.Errorf("invalid or unaddressable value: %v", colName)
}
*i = append(*i, v.Addr().Interface())
return colName, nil
}
func (i *ScanDest) GetScanDest() ScanDest {
return *i
}