|
|
@ -49,11 +49,11 @@ func (eDays *ExpirationDays) UnmarshalXML(d *xml.Decoder, startElement xml.Start |
|
|
|
|
|
|
|
|
|
|
|
// MarshalXML encodes number of days to expire if it is non-zero and
|
|
|
|
// MarshalXML encodes number of days to expire if it is non-zero and
|
|
|
|
// encodes empty string otherwise
|
|
|
|
// encodes empty string otherwise
|
|
|
|
func (eDays *ExpirationDays) MarshalXML(e *xml.Encoder, startElement xml.StartElement) error { |
|
|
|
func (eDays ExpirationDays) MarshalXML(e *xml.Encoder, startElement xml.StartElement) error { |
|
|
|
if *eDays == ExpirationDays(0) { |
|
|
|
if eDays == 0 { |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
return e.EncodeElement(int(*eDays), startElement) |
|
|
|
return e.EncodeElement(int(eDays), startElement) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ExpirationDate is a embedded type containing time.Time to unmarshal
|
|
|
|
// ExpirationDate is a embedded type containing time.Time to unmarshal
|
|
|
@ -90,8 +90,8 @@ func (eDate *ExpirationDate) UnmarshalXML(d *xml.Decoder, startElement xml.Start |
|
|
|
|
|
|
|
|
|
|
|
// MarshalXML encodes expiration date if it is non-zero and encodes
|
|
|
|
// MarshalXML encodes expiration date if it is non-zero and encodes
|
|
|
|
// empty string otherwise
|
|
|
|
// empty string otherwise
|
|
|
|
func (eDate *ExpirationDate) MarshalXML(e *xml.Encoder, startElement xml.StartElement) error { |
|
|
|
func (eDate ExpirationDate) MarshalXML(e *xml.Encoder, startElement xml.StartElement) error { |
|
|
|
if *eDate == (ExpirationDate{time.Time{}}) { |
|
|
|
if eDate.Time.IsZero() { |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
return e.EncodeElement(eDate.Format(time.RFC3339), startElement) |
|
|
|
return e.EncodeElement(eDate.Format(time.RFC3339), startElement) |
|
|
|