Documentation
¶
Index ¶
- type Codec
- type Error
- type Field
- type Fields
- type Func
- type Object
- func (o Object) At(key string, fn Func) error
- func (o Object) Copy() Object
- func (o Object) Decode(c Codec) error
- func (o Object) Encode(c Codec) error
- func (o Object) Fields() Fields
- func (o Object) ForEach(fn Func) error
- func (o Object) Keys() []string
- func (o Object) Merge(u Object) Object
- func (o Object) Put(key string, fn Func) error
- func (o Object) ReverseWalk(fn Func) error
- func (o Object) Schema() Object
- func (o Object) Shake() Object
- func (o Object) String() string
- func (o Object) Value() interface{}
- func (o Object) Walk(fn Func) error
- func (o Object) WriteTab(w io.Writer) (n int64, err error)
- func (o Object) WriteTo(w io.Writer) (int64, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Object ¶
type Object map[string]struct { Encoding string `json:"e,omitempty" yaml:"e,omitempty"` Value interface{} `json:"v,omitempty" yaml:"v,omitempty"` Children Object `json:"c,omitempty" yaml:"c,omitempty"` }
func (Object) Put ¶
Example ¶
obj := make(cti.Object) obj.Put("/foo/bar", cti.Value(`{"key":[{"name":true},{"name":1}]}`)) if err := obj.Decode(nil); err != nil { log.Fatalf("obj.Decode()=%+v", err) } obj.Put("/foo/bar/key/1/args", cti.Value("--foo=bar --key=20")) if err := obj.Decode(nil); err != nil { log.Fatalf("obj.Decode()=%+v", err) } obj.WriteTo(os.Stderr) p, err := yaml.Marshal(obj.Value()) if err != nil { log.Fatalf("yaml.Marshal()=%+v", err) } fmt.Printf("%s\n", p)
Output: foo: bar: key: - name: true - args: --foo: bar --key: 20 name: 1
func (Object) ReverseWalk ¶
Click to show internal directories.
Click to hide internal directories.