go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/projects/nodes/pkg/model/gen/table_column.go (about)

     1  // File generated by nodegen. DO NOT EDIT.
     2  package gen
     3  
     4  import (
     5  	"fmt"
     6  	"time"
     7  
     8  	"github.com/wcharczuk/go-incr"
     9  	"go.charczuk.com/projects/nodes/pkg/funcs"
    10  	"go.charczuk.com/projects/nodes/pkg/incrutil"
    11  	"go.charczuk.com/projects/nodes/pkg/types"
    12  )
    13  
    14  func TableColumnForNode(graph *incr.Graph, n *types.Node) (output incr.INode, err error) {
    15  	switch n.Metadata.OutputType {
    16  
    17  	case "[]bool":
    18  		output = incrutil.Map2[int64, *types.Table, []bool](graph, funcs.TableColumn[[]bool])
    19  		return
    20  	case "[]float64":
    21  		output = incrutil.Map2[int64, *types.Table, []float64](graph, funcs.TableColumn[[]float64])
    22  		return
    23  	case "[]int64":
    24  		output = incrutil.Map2[int64, *types.Table, []int64](graph, funcs.TableColumn[[]int64])
    25  		return
    26  	case "[]string":
    27  		output = incrutil.Map2[int64, *types.Table, []string](graph, funcs.TableColumn[[]string])
    28  		return
    29  	case "[]duration":
    30  		output = incrutil.Map2[int64, *types.Table, []time.Duration](graph, funcs.TableColumn[[]time.Duration])
    31  		return
    32  	case "[]timestamp":
    33  		output = incrutil.Map2[int64, *types.Table, []time.Time](graph, funcs.TableColumn[[]time.Time])
    34  		return
    35  	default:
    36  		err = fmt.Errorf("invalid tablecolumn output type %v", n.Metadata.OutputType)
    37  		return
    38  	}
    39  }