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