go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/projects/nodes/pkg/incrutil/interfaces.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 incrutil 9 10 import ( 11 "github.com/wcharczuk/go-incr" 12 ) 13 14 // IInputs is an interface types can implement to get node inputs. 15 type IInputs interface { 16 Inputs() map[string]incr.INode 17 } 18 19 // IAddInput is an interface that allows nodes to add nodes without an associated name, e.g. for MapN. 20 type IAddInput interface { 21 AddInput(incr.INode) error 22 } 23 24 // ISetInput is an interface for just the add untyped input function. 25 type ISetInput interface { 26 SetInput(inputName string, inputNode incr.INode, isDeserialize bool) error 27 } 28 29 // IRemoveInput is an interface that allows nodes to remove an input by an associated name. 30 type IRemoveInput interface { 31 RemoveInput(string) error 32 } 33 34 // IRemoveInputByID is an interface that allows nodes to remove an input by parent node id. 35 type IRemoveInputByID interface { 36 RemoveInputByID(incr.Identifier) error 37 } 38 39 // IRemoveInputByID is an interface for just the remove input function. 40 type IRemoveInputByNodeID interface { 41 RemoveInputByNodeID(incr.Identifier) 42 } 43 44 // ISetRawVarValue is an interface for just the add untyped input function. 45 type ISetRawVarValue interface { 46 SetRawVarValue(any) error 47 } 48 49 // ISetRawValue is an interface for just the add untyped input function. 50 type ISetRawValue interface { 51 SetRawValue(any) error 52 } 53 54 // IRawValue is an interface for just the remove input function. 55 type IRawValue interface { 56 RawValue() any 57 } 58 59 // IRawFunction is an interface for getting the raw function. 60 type IRawFunction interface { 61 RawFunction() any 62 } 63 64 // ISetRawFunction is an interface for setting the raw function. 65 type ISetRawFunction interface { 66 SetRawFunction(fn any) error 67 }