go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/projects/nodes/pkg/model/node_from_inode.go (about) 1 /* 2 3 Copyright (c) 2023 - Present. Will Charczuk. All rights reserved. 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file at the root of the repository. 5 6 */ 7 8 package model 9 10 import ( 11 "github.com/wcharczuk/go-incr" 12 "go.charczuk.com/projects/nodes/pkg/types" 13 ) 14 15 // NodeFromINode returns a node from an incr inode. 16 func NodeFromINode(g *incr.Graph, n incr.INode) types.Node { 17 nn := n.Node() 18 enn := incr.ExpertNode(n) 19 nodeMeta, _ := nn.Metadata().(*types.NodeMetadata) 20 return types.Node{ 21 ID: nn.ID(), 22 Label: nn.Label(), 23 Metadata: *nodeMeta, 24 Always: enn.Always(), 25 ChangedAt: enn.ChangedAt(), 26 RecomputedAt: enn.RecomputedAt(), 27 SetAt: enn.SetAt(), 28 Height: enn.Height(), 29 } 30 }