go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/projects/nodes/pkg/model/gen/var.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 VarForNode(graph *incr.Graph, n *types.Node) (output incr.INode, err error) { 15 switch n.Metadata.OutputType { 16 17 case "[]bool": 18 output = incrutil.Var(graph, funcs.Zero[[]bool]()) 19 return 20 case "[]float64": 21 output = incrutil.Var(graph, funcs.Zero[[]float64]()) 22 return 23 case "[]int64": 24 output = incrutil.Var(graph, funcs.Zero[[]int64]()) 25 return 26 case "[]string": 27 output = incrutil.Var(graph, funcs.Zero[[]string]()) 28 return 29 case "[]duration": 30 output = incrutil.Var(graph, funcs.Zero[[]time.Duration]()) 31 return 32 case "[]timestamp": 33 output = incrutil.Var(graph, funcs.Zero[[]time.Time]()) 34 return 35 case "bool": 36 output = incrutil.Var(graph, funcs.Zero[bool]()) 37 return 38 case "float64": 39 output = incrutil.Var(graph, funcs.Zero[float64]()) 40 return 41 case "int64": 42 output = incrutil.Var(graph, funcs.Zero[int64]()) 43 return 44 case "string": 45 output = incrutil.Var(graph, funcs.Zero[string]()) 46 return 47 case "duration": 48 output = incrutil.Var(graph, funcs.Zero[time.Duration]()) 49 return 50 case "timestamp": 51 output = incrutil.Var(graph, funcs.Zero[time.Time]()) 52 return 53 default: 54 err = fmt.Errorf("invalid var output type %v", n.Metadata.OutputType) 55 return 56 } 57 }