diff --git a/attribute.go b/attribute.go index 69610f9..5611066 100644 --- a/attribute.go +++ b/attribute.go @@ -303,7 +303,60 @@ func (e *AttributeEncoder) Encode(attribute string, value interface{}) error { } } default: - return fmt.Errorf("type %T is not supported", value) + if tag != TagBeginCollection { + return fmt.Errorf("type %T is not supported", value) + } + + if err := e.encodeTag(TagBeginCollection); err != nil { + return err + } + + if err := e.encodeString(attribute); err != nil { + return err + } + + if err := e.writeNullByte(); err != nil { + return err + } + + for member, value := range value.(map[string]interface{}) { + fmt.Println(member, value) + if err := e.encodeTag(TagMemberName); err != nil { + return err + } + + if err := e.writeNullByte(); err != nil { + return err + } + + if err := e.encodeString(member); err != nil { + return err + } + + if err := e.encodeTag(TagKeyword); err != nil { + return err + } + + if err := e.writeNullByte(); err != nil { + return err + } + + if err := e.encodeString(value.(string)); err != nil { + return err + } + } + + if err := e.encodeTag(TagEndCollection); err != nil { + return err + } + + if err := e.writeNullByte(); err != nil { + return err + } + + if err := e.writeNullByte(); err != nil { + return err + } } return nil diff --git a/constants.go b/constants.go index 31c8b29..7931534 100644 --- a/constants.go +++ b/constants.go @@ -352,7 +352,8 @@ const ( AttributeJobKilobyteOctets = "job-k-octets" AttributeNumberOfDocuments = "number-of-documents" AttributeJobOriginatingUserName = "job-originating-user-name" - AttributeOutputOrder = "outputorder" + AttributeOutputOrder = "outputorder", + AttributeMediaCol = "media-col", ) // Default attributes @@ -416,5 +417,6 @@ var ( AttributeStatusMessage: TagText, AttributeLimit: TagInteger, AttributeOutputOrder: TagName, + AttributeMediaCol: TagBeginCollection, } )