diff pkg/soap/nts/service.go @ 3709:d4a8d084eab4

import: Use dates_issue parameter in gm imports.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 20 Jun 2019 11:16:14 +0200
parents d38b20ccb6f9
children eb2f949ddfa2
line wrap: on
line diff
--- a/pkg/soap/nts/service.go	Thu Jun 20 10:27:14 2019 +0200
+++ b/pkg/soap/nts/service.go	Thu Jun 20 11:16:14 2019 +0200
@@ -29,6 +29,8 @@
 
 type DateTime struct{ time.Time }
 
+type Date struct{ time.Time }
+
 func (dt *DateTime) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
 	var value string
 	if err := d.DecodeElement(&value, &start); err != nil {
@@ -42,6 +44,11 @@
 	return nil
 }
 
+func (d *Date) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
+	formated := d.Format("2006-01-02")
+	return e.EncodeElement(formated, start)
+}
+
 type Message_type_type string
 
 const (
@@ -101,7 +108,7 @@
 
 	Validity_period *Validity_period_type `xml:"validity_period,omitempty"`
 
-	Dates_issue []*Date_pair `xml:"dates_issue,omitempty"`
+	Dates_issue []*Date_pair `xml:"http://www.ris.eu/nts.ms/2.0.4.0 dates_issue,omitempty"`
 
 	Paging_request *Paging_request_type `xml:"paging_request,omitempty"`
 }
@@ -123,11 +130,11 @@
 }
 
 type Date_pair struct {
-	XMLName xml.Name `xml:"http://www.ris.eu/nts/4.0.4.0 date_pair"`
-
-	Date_start time.Time `xml:"date_start,omitempty"`
-
-	Date_end time.Time `xml:"date_end,omitempty"`
+	XMLName xml.Name `xml:"http://www.ris.eu/nts.ms/2.0.4.0 dates_issue"`
+
+	Date_start Date `xml:"http://www.ris.eu/nts.ms/2.0.4.0 date_start,omitempty"`
+
+	Date_end Date `xml:"http://www.ris.eu/nts.ms/2.0.4.0 date_end,omitempty"`
 }
 
 type Paging_request_type struct {