Documentation ¶
Index ¶
- type Encoder
- func (e *Encoder) Encode() (io.ReadSeeker, error)
- func (e *Encoder) List(t protocol.Target, k string, meta protocol.Metadata) protocol.ListEncoder
- func (e *Encoder) Map(t protocol.Target, k string, meta protocol.Metadata) protocol.MapEncoder
- func (e *Encoder) SetFields(t protocol.Target, k string, m protocol.FieldMarshaler, meta protocol.Metadata)
- func (e *Encoder) SetStream(t protocol.Target, k string, v protocol.StreamMarshaler, ...)
- func (e *Encoder) SetValue(t protocol.Target, k string, v protocol.ValueMarshaler, meta protocol.Metadata)
- type ListEncoder
- type MapEncoder
- func (e *MapEncoder) End()
- func (e *MapEncoder) List(k string) protocol.ListEncoder
- func (e *MapEncoder) Map(k string) protocol.MapEncoder
- func (e *MapEncoder) MapSetFields(k string, m protocol.FieldMarshaler)
- func (e *MapEncoder) MapSetList(k string, fn func(le protocol.ListEncoder))
- func (e *MapEncoder) MapSetMap(k string, fn func(me protocol.MapEncoder))
- func (e *MapEncoder) MapSetValue(k string, v protocol.ValueMarshaler)
- func (e *MapEncoder) Start()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
An Encoder provides encoding of the AWS XML protocol. This encoder will will write all content to XML. Only supports body and payload targets.
func NewEncoder ¶
func NewEncoder() *Encoder
NewEncoder creates a new encoder for encoding AWS XML protocol. Only encodes fields into the XML body, and error is returned if target is anything other than Body or Payload.
func (*Encoder) Encode ¶
func (e *Encoder) Encode() (io.ReadSeeker, error)
Encode returns the encoded XMl reader. An error will be returned if one was encountered while building the XML body.
func (*Encoder) List ¶
List creates an XML list and calls the passed in fn callback with a list encoder.
func (*Encoder) Map ¶
Map creates an XML map and calls the passed in fn callback with a map encoder.
func (*Encoder) SetFields ¶
func (e *Encoder) SetFields(t protocol.Target, k string, m protocol.FieldMarshaler, meta protocol.Metadata)
SetFields sets the nested fields to the XML body.
type ListEncoder ¶
type ListEncoder struct { Base *Encoder Key string Metadata protocol.Metadata Token xml.StartElement // contains filtered or unexported fields }
A ListEncoder encodes elements within a list for the XML encoder.
func (*ListEncoder) End ¶
func (e *ListEncoder) End()
End will write the end element if the list is not flat.
func (*ListEncoder) List ¶
func (e *ListEncoder) List() protocol.ListEncoder
List will return an error since nested collections are not support by this protocol.
func (*ListEncoder) ListAddFields ¶
func (e *ListEncoder) ListAddFields(m protocol.FieldMarshaler)
ListAddFields will set the nested type's fields to the list.
func (*ListEncoder) ListAddValue ¶
func (e *ListEncoder) ListAddValue(v protocol.ValueMarshaler)
ListAddValue will add the value to the list.
func (*ListEncoder) Map ¶
func (e *ListEncoder) Map() protocol.MapEncoder
Map will return an error since nested collections are not support by this protocol.
func (*ListEncoder) Start ¶
func (e *ListEncoder) Start()
Start will write the start element and set the token for closing
type MapEncoder ¶
type MapEncoder struct { Base *Encoder Flatten bool Key string KeyName string ValueName string Token xml.StartElement Metadata protocol.Metadata // contains filtered or unexported fields }
A MapEncoder encodes key values pair map values for the XML encoder.
func (*MapEncoder) List ¶
func (e *MapEncoder) List(k string) protocol.ListEncoder
List will set err as nested collections are not supported in this protocol.
func (*MapEncoder) Map ¶
func (e *MapEncoder) Map(k string) protocol.MapEncoder
Map will set err as nested collections are not supported in this protocol.
func (*MapEncoder) MapSetFields ¶
func (e *MapEncoder) MapSetFields(k string, m protocol.FieldMarshaler)
MapSetFields will set the nested type's fields under the map.
func (*MapEncoder) MapSetList ¶
func (e *MapEncoder) MapSetList(k string, fn func(le protocol.ListEncoder))
MapSetList is not supported.
func (*MapEncoder) MapSetMap ¶
func (e *MapEncoder) MapSetMap(k string, fn func(me protocol.MapEncoder))
MapSetMap is not supported.
func (*MapEncoder) MapSetValue ¶
func (e *MapEncoder) MapSetValue(k string, v protocol.ValueMarshaler)
MapSetValue sets a map value.
func (*MapEncoder) Start ¶
func (e *MapEncoder) Start()
Start will open a new scope by creating a new XML start element tag.