cbcd945251
* 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
23 lines
406 B
Go
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
|
|
}
|