func createColumns()

in internal/oraclemetrics/oraclemetrics.go [463:488]


func createColumns(queryColumns []*configpb.Column) []any {
	if len(queryColumns) == 0 {
		return nil
	}
	cols := make([]any, len(queryColumns))
	for i, c := range queryColumns {
		var col any
		switch c.GetValueType() {
		case configpb.ValueType_VALUE_INT64:
			col = new(int64)
		case configpb.ValueType_VALUE_DOUBLE:
			col = new(float64)
		case configpb.ValueType_VALUE_BOOL:
			col = new(bool)
		case configpb.ValueType_VALUE_STRING:
			col = new(string)
		default:
			// Rows.Scan() is able to populate any cell as *interface{} by
			// "copying the value provided by the underlying driver without conversion".
			// Reference: https://pkg.go.dev/database/sql#Rows.Scan
			col = new(any)
		}
		cols[i] = col
	}
	return cols
}