diff options
author | NeonXP <i@neonxp.dev> | 2022-11-21 04:46:32 +0300 |
---|---|---|
committer | NeonXP <i@neonxp.dev> | 2022-11-21 04:46:32 +0300 |
commit | 0d431048d3e68609b90306efd9ed015143ae651f (patch) | |
tree | 2a5fe21654bb9af02a0419722f2cd80d588465a2 /model/booleanNode.go | |
parent | 4054a50ce4232ebfc4dae043863ad96d46b25b43 (diff) |
added set method
Diffstat (limited to 'model/booleanNode.go')
-rw-r--r-- | model/booleanNode.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/model/booleanNode.go b/model/booleanNode.go index bc2d60e..aba286e 100644 --- a/model/booleanNode.go +++ b/model/booleanNode.go @@ -1,5 +1,7 @@ package model +import "fmt" + type BooleanNode struct { Value bool } @@ -14,3 +16,12 @@ func (n *BooleanNode) MarshalJSON() ([]byte, error) { } return []byte("false"), nil } + +func (n *BooleanNode) Set(v any) error { + val, ok := v.(bool) + if !ok { + return fmt.Errorf("%v is not boolean", v) + } + n.Value = val + return nil +} |