blob: b8dfcfb2a2b4da1716034709eb35d69e58b44c37 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package model
import "fmt"
type StringNode struct {
Value string
}
func (n StringNode) Type() NodeType {
return StringType
}
func (n *StringNode) MarshalJSON() ([]byte, error) {
return []byte(`"` + n.Value + `"`), nil
}
func (n *StringNode) Set(v any) error {
val, ok := v.(string)
if !ok {
return fmt.Errorf("%v is not string", v)
}
n.Value = val
return nil
}
|