Skip to content

Commit 985788a

Browse files
committed
Refactor anonymous structs
1 parent 429e105 commit 985788a

File tree

3 files changed

+164
-117
lines changed

3 files changed

+164
-117
lines changed

pkg/wcs201/getcapabilities_response.go

Lines changed: 62 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -60,49 +60,70 @@ type Namespaces struct {
6060

6161
// ServiceIdentification struct should only be fill by the "template" configuration wcs201.yaml
6262
type ServiceIdentification struct {
63-
Title string `xml:"ows:Title" yaml:"title"`
64-
Abstract string `xml:"ows:Abstract" yaml:"abstract"`
65-
Keywords *wsc200.Keywords `xml:"ows:Keywords" yaml:"keywords"`
66-
ServiceType struct {
67-
Text string `xml:",chardata" yaml:"text"`
68-
CodeSpace string `xml:"codeSpace,attr" yaml:"codeSpace"`
69-
} `xml:"ows:ServiceType" yaml:"serviceType"`
70-
ServiceTypeVersion []string `xml:"ows:ServiceTypeVersion" yaml:"serviceTypeVersion"`
71-
Profile []string `xml:"ows:Profile" yaml:"profile"`
72-
Fees string `xml:"ows:Fees" yaml:"fees"`
73-
AccessConstraints string `xml:"ows:AccessConstraints" yaml:"accessConstraints"`
63+
Title string `xml:"ows:Title" yaml:"title"`
64+
Abstract string `xml:"ows:Abstract" yaml:"abstract"`
65+
Keywords *wsc200.Keywords `xml:"ows:Keywords" yaml:"keywords"`
66+
ServiceType ServiceType `xml:"ows:ServiceType" yaml:"serviceType"`
67+
ServiceTypeVersion []string `xml:"ows:ServiceTypeVersion" yaml:"serviceTypeVersion"`
68+
Profile []string `xml:"ows:Profile" yaml:"profile"`
69+
Fees string `xml:"ows:Fees" yaml:"fees"`
70+
AccessConstraints string `xml:"ows:AccessConstraints" yaml:"accessConstraints"`
71+
}
72+
73+
// ServiceType struct containing the service type
74+
type ServiceType struct {
75+
Text string `xml:",chardata" yaml:"text"`
76+
CodeSpace string `xml:"codeSpace,attr" yaml:"codeSpace"`
7477
}
7578

7679
// ServiceProvider struct containing the provider/organization information should only be fill by the "template" configuration wcs201.yaml
7780
type ServiceProvider struct {
78-
ProviderName string `xml:"ows:ProviderName" yaml:"providerName"`
79-
ProviderSite struct {
80-
Type string `xml:"xlink:type,attr" yaml:"type"`
81-
Href string `xml:"xlink:href,attr" yaml:"href"`
82-
} `xml:"ows:ProviderSite" yaml:"providerSite"`
83-
ServiceContact struct {
84-
IndividualName string `xml:"ows:IndividualName" yaml:"individualName"`
85-
PositionName string `xml:"ows:PositionName" yaml:"positionName"`
86-
ContactInfo struct {
87-
Phone struct {
88-
Voice string `xml:"ows:Voice" yaml:"voice"`
89-
Facsimile string `xml:"ows:Facsimile" yaml:"facsimile"`
90-
} `xml:"ows:Phone" yaml:"phone"`
91-
Address struct {
92-
DeliveryPoint string `xml:"ows:DeliveryPoint" yaml:"deliveryPoint"`
93-
City string `xml:"ows:City" yaml:"city"`
94-
AdministrativeArea string `xml:"ows:AdministrativeArea" yaml:"administrativeArea"`
95-
PostalCode string `xml:"ows:PostalCode" yaml:"postalCode"`
96-
Country string `xml:"ows:Country" yaml:"country"`
97-
ElectronicMailAddress string `xml:"ows:ElectronicMailAddress" yaml:"electronicMailAddress"`
98-
} `xml:"ows:Address" yaml:"address"`
99-
OnlineResource *struct {
100-
Type string `xml:"xlink:type,attr,omitempty" yaml:"type"`
101-
Href string `xml:"xlink:href,attr,omitempty" yaml:"href"`
102-
} `xml:"ows:OnlineResource,omitempty" yaml:"onlineResource"`
103-
HoursOfService string `xml:"ows:HoursOfService,omitempty" yaml:"hoursOfService"`
104-
ContactInstructions string `xml:"ows:ContactInstructions,omitempty" yaml:"contactInstructions"`
105-
} `xml:"ows:ContactInfo" yaml:"contactInfo"`
106-
Role string `xml:"ows:Role,omitempty" yaml:"role"`
107-
} `xml:"ows:ServiceContact" yaml:"serviceContact"`
81+
ProviderName string `xml:"ows:ProviderName" yaml:"providerName"`
82+
ProviderSite `xml:"ows:ProviderSite" yaml:"providerSite"`
83+
ServiceContact ServiceContact `xml:"ows:ServiceContact" yaml:"serviceContact"`
84+
}
85+
86+
// ProviderSite struct containing the website of the provider/organization
87+
type ProviderSite struct {
88+
Type string `xml:"xlink:type,attr" yaml:"type"`
89+
Href string `xml:"xlink:href,attr" yaml:"href"`
90+
}
91+
92+
// ServiceContact struct containing information for the person to contact
93+
type ServiceContact struct {
94+
IndividualName string `xml:"ows:IndividualName" yaml:"individualName"`
95+
PositionName string `xml:"ows:PositionName" yaml:"positionName"`
96+
ContactInfo ContactInfo `xml:"ows:ContactInfo" yaml:"contactInfo"`
97+
Role string `xml:"ows:Role,omitempty" yaml:"role"`
98+
}
99+
100+
// ContactInfo struct containing the contact information for the service
101+
type ContactInfo struct {
102+
Phone Phone `xml:"ows:Phone" yaml:"phone"`
103+
Address Address `xml:"ows:Address" yaml:"address"`
104+
OnlineResource *OnlineResource `xml:"ows:OnlineResource,omitempty" yaml:"onlineResource"`
105+
HoursOfService string `xml:"ows:HoursOfService,omitempty" yaml:"hoursOfService"`
106+
ContactInstructions string `xml:"ows:ContactInstructions,omitempty" yaml:"contactInstructions"`
107+
}
108+
109+
// Phone struct containing the contact telephone or fax number
110+
type Phone struct {
111+
Voice string `xml:"ows:Voice" yaml:"voice"`
112+
Facsimile string `xml:"ows:Facsimile" yaml:"facsimile"`
113+
}
114+
115+
// Address struct containing the address for the contact supplying the service
116+
type Address struct {
117+
DeliveryPoint string `xml:"ows:DeliveryPoint" yaml:"deliveryPoint"`
118+
City string `xml:"ows:City" yaml:"city"`
119+
AdministrativeArea string `xml:"ows:AdministrativeArea" yaml:"administrativeArea"`
120+
PostalCode string `xml:"ows:PostalCode" yaml:"postalCode"`
121+
Country string `xml:"ows:Country" yaml:"country"`
122+
ElectronicMailAddress string `xml:"ows:ElectronicMailAddress" yaml:"electronicMailAddress"`
123+
}
124+
125+
// OnlineResource struct containing the top-level web address of a service or service provider
126+
type OnlineResource *struct {
127+
Type string `xml:"xlink:type,attr,omitempty" yaml:"type"`
128+
Href string `xml:"xlink:href,attr,omitempty" yaml:"href"`
108129
}

pkg/wfs200/getcapabilities_response.go

Lines changed: 65 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -60,53 +60,74 @@ type Namespaces struct {
6060
SchemaLocation string `xml:"xsi:schemaLocation,attr" yaml:"schemaLocation"`
6161
}
6262

63-
// ServiceIdentification struct should only be fill by the "template" configuration wfs200.yaml
63+
// ServiceIdentification struct should only be filled by the "template" configuration wfs200.yaml
6464
type ServiceIdentification struct {
65-
XMLName xml.Name `xml:"ows:ServiceIdentification"`
66-
Title string `xml:"ows:Title" yaml:"title"`
67-
Abstract string `xml:"ows:Abstract" yaml:"abstract"`
68-
Keywords *wsc110.Keywords `xml:"ows:Keywords" yaml:"keywords"`
69-
ServiceType struct {
70-
Text string `xml:",chardata" yaml:"text"`
71-
CodeSpace string `xml:"codeSpace,attr" yaml:"codeSpace"`
72-
} `xml:"ows:ServiceType" yaml:"serviceType"`
73-
ServiceTypeVersion string `xml:"ows:ServiceTypeVersion" yaml:"serviceTypeVersion"`
74-
Fees string `xml:"ows:Fees" yaml:"fees"`
75-
AccessConstraints string `xml:"ows:AccessConstraints" yaml:"accessConstraints"`
65+
XMLName xml.Name `xml:"ows:ServiceIdentification"`
66+
Title string `xml:"ows:Title" yaml:"title"`
67+
Abstract string `xml:"ows:Abstract" yaml:"abstract"`
68+
Keywords *wsc110.Keywords `xml:"ows:Keywords" yaml:"keywords"`
69+
ServiceType ServiceType `xml:"ows:ServiceType" yaml:"serviceType"`
70+
ServiceTypeVersion string `xml:"ows:ServiceTypeVersion" yaml:"serviceTypeVersion"`
71+
Fees string `xml:"ows:Fees" yaml:"fees"`
72+
AccessConstraints string `xml:"ows:AccessConstraints" yaml:"accessConstraints"`
73+
}
74+
75+
// ServiceType struct containing the service type
76+
type ServiceType struct {
77+
Text string `xml:",chardata" yaml:"text"`
78+
CodeSpace string `xml:"codeSpace,attr" yaml:"codeSpace"`
7679
}
7780

7881
// ServiceProvider struct containing the provider/organization information should only be fill by the "template" configuration wfs200.yaml
7982
type ServiceProvider struct {
80-
XMLName xml.Name `xml:"ows:ServiceProvider"`
81-
ProviderName string `xml:"ows:ProviderName" yaml:"providerName"`
82-
ProviderSite struct {
83-
Type string `xml:"xlink:type,attr" yaml:"type"`
84-
Href string `xml:"xlink:href,attr" yaml:"href"`
85-
} `xml:"ows:ProviderSite" yaml:"providerSite"`
86-
ServiceContact struct {
87-
IndividualName string `xml:"ows:IndividualName" yaml:"individualName"`
88-
PositionName string `xml:"ows:PositionName" yaml:"positionName"`
89-
ContactInfo struct {
90-
Text string `xml:",chardata"`
91-
Phone struct {
92-
Voice string `xml:"ows:Voice" yaml:"voice"`
93-
Facsimile string `xml:"ows:Facsimile" yaml:"facsimile"`
94-
} `xml:"ows:Phone" yaml:"phone"`
95-
Address struct {
96-
DeliveryPoint string `xml:"ows:DeliveryPoint" yaml:"deliveryPoint"`
97-
City string `xml:"ows:City" yaml:"city"`
98-
AdministrativeArea string `xml:"ows:AdministrativeArea" yaml:"administrativeArea"`
99-
PostalCode string `xml:"ows:PostalCode" yaml:"postalCode"`
100-
Country string `xml:"ows:Country" yaml:"country"`
101-
ElectronicMailAddress string `xml:"ows:ElectronicMailAddress" yaml:"electronicMailAddress"`
102-
} `xml:"ows:Address" yaml:"address"`
103-
OnlineResource struct {
104-
Type string `xml:"xlink:type,attr" yaml:"type"`
105-
Href string `xml:"xlink:href,attr" yaml:"href"`
106-
} `xml:"ows:OnlineResource" yaml:"onlineResource"`
107-
HoursOfService string `xml:"ows:HoursOfService" yaml:"hoursOfService"`
108-
ContactInstructions string `xml:"ows:ContactInstructions" yaml:"contactInstructions"`
109-
} `xml:"ows:ContactInfo" yaml:"contactInfo"`
110-
Role string `xml:"ows:Role" yaml:"role"`
111-
} `xml:"ows:ServiceContact" yaml:"serviceContact"`
83+
XMLName xml.Name `xml:"ows:ServiceProvider"`
84+
ProviderName string `xml:"ows:ProviderName" yaml:"providerName"`
85+
ProviderSite ProviderSite `xml:"ows:ProviderSite" yaml:"providerSite"`
86+
ServiceContact ServiceContact `xml:"ows:ServiceContact" yaml:"serviceContact"`
87+
}
88+
89+
// ProviderSite struct containing the website of the provider/organization
90+
type ProviderSite struct {
91+
Type string `xml:"xlink:type,attr" yaml:"type"`
92+
Href string `xml:"xlink:href,attr" yaml:"href"`
93+
}
94+
95+
// ServiceContact struct containing information for the person to contact
96+
type ServiceContact struct {
97+
IndividualName string `xml:"ows:IndividualName" yaml:"individualName"`
98+
PositionName string `xml:"ows:PositionName" yaml:"positionName"`
99+
ContactInfo ContactInfo `xml:"ows:ContactInfo" yaml:"contactInfo"`
100+
Role string `xml:"ows:Role" yaml:"role"`
101+
}
102+
103+
// ContactInfo struct containing the contact information for the service
104+
type ContactInfo struct {
105+
Text string `xml:",chardata"`
106+
Phone Phone `xml:"ows:Phone" yaml:"phone"`
107+
Address Address `xml:"ows:Address" yaml:"address"`
108+
OnlineResource OnlineResource `xml:"ows:OnlineResource" yaml:"onlineResource"`
109+
HoursOfService string `xml:"ows:HoursOfService" yaml:"hoursOfService"`
110+
ContactInstructions string `xml:"ows:ContactInstructions" yaml:"contactInstructions"`
111+
}
112+
113+
// Phone struct containing the contact telephone or fax number
114+
type Phone struct {
115+
Voice string `xml:"ows:Voice" yaml:"voice"`
116+
Facsimile string `xml:"ows:Facsimile" yaml:"facsimile"`
117+
}
118+
119+
// Address struct containing the address for the contact supplying the service
120+
type Address struct {
121+
DeliveryPoint string `xml:"ows:DeliveryPoint" yaml:"deliveryPoint"`
122+
City string `xml:"ows:City" yaml:"city"`
123+
AdministrativeArea string `xml:"ows:AdministrativeArea" yaml:"administrativeArea"`
124+
PostalCode string `xml:"ows:PostalCode" yaml:"postalCode"`
125+
Country string `xml:"ows:Country" yaml:"country"`
126+
ElectronicMailAddress string `xml:"ows:ElectronicMailAddress" yaml:"electronicMailAddress"`
127+
}
128+
129+
// OnlineResource struct containing the top-level web address of a service or service provider
130+
type OnlineResource struct {
131+
Type string `xml:"xlink:type,attr" yaml:"type"`
132+
Href string `xml:"xlink:href,attr" yaml:"href"`
112133
}

pkg/wms130/getcapabilities_response.go

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -56,36 +56,41 @@ type Namespaces struct {
5656

5757
// WMSService struct containing the base service information filled from the template
5858
type WMSService struct {
59-
Name string `xml:"Name" yaml:"name"`
60-
Title string `xml:"Title" yaml:"title"`
61-
Abstract string `xml:"Abstract" yaml:"abstract"`
62-
KeywordList *Keywords `xml:"KeywordList" yaml:"keywordList"`
63-
OnlineResource struct {
64-
Xlink *string `xml:"xmlns:xlink,attr" yaml:"xlink"`
65-
Type *string `xml:"xlink:type,attr" yaml:"type"`
66-
Href *string `xml:"xlink:href,attr" yaml:"href"`
67-
} `xml:"OnlineResource" yaml:"onlineResource"`
68-
ContactInformation struct {
69-
ContactPersonPrimary struct {
70-
ContactPerson string `xml:"ContactPerson" yaml:"contactPerson"`
71-
ContactOrganization string `xml:"ContactOrganization" yaml:"contactOrganization"`
72-
} `xml:"ContactPersonPrimary" yaml:"contactPersonPrimary"`
73-
ContactPosition string `xml:"ContactPosition" yaml:"contactPosition"`
74-
ContactAddress struct {
75-
AddressType string `xml:"AddressType" yaml:"addressType"`
76-
Address string `xml:"Address" yaml:"address"`
77-
City string `xml:"City" yaml:"city"`
78-
StateOrProvince string `xml:"StateOrProvince" yaml:"stateOrProvince"`
79-
PostalCode string `xml:"PostCode" yaml:"postalCode"`
80-
Country string `xml:"Country" yaml:"country"`
81-
} `xml:"ContactAddress" yaml:"contactAddress"`
82-
ContactVoiceTelephone string `xml:"ContactVoiceTelephone" yaml:"contactVoiceTelephone"`
83-
ContactFacsimileTelephone string `xml:"ContactFacsimileTelephone" yaml:"contactFacsimileTelephone"`
84-
ContactElectronicMailAddress string `xml:"ContactElectronicMailAddress" yaml:"contactElectronicMailAddress"`
85-
} `xml:"ContactInformation" yaml:"contactInformation"`
86-
Fees string `xml:"Fees" yaml:"fees"`
87-
AccessConstraints string `xml:"AccessConstraints" yaml:"accessConstraints"`
88-
LayerLimit int `xml:"LayerLimit,omitempty" yaml:"layerLimit"`
89-
MaxWidth int `xml:"MaxWidth,omitempty" yaml:"maxWidth"`
90-
MaxHeight int `xml:"MaxHeight,omitempty" yaml:"maxHeight"`
59+
Name string `xml:"Name" yaml:"name"`
60+
Title string `xml:"Title" yaml:"title"`
61+
Abstract string `xml:"Abstract" yaml:"abstract"`
62+
KeywordList *Keywords `xml:"KeywordList" yaml:"keywordList"`
63+
OnlineResource OnlineResource `xml:"OnlineResource" yaml:"onlineResource"`
64+
ContactInformation ContactInformation `xml:"ContactInformation" yaml:"contactInformation"`
65+
Fees string `xml:"Fees" yaml:"fees"`
66+
AccessConstraints string `xml:"AccessConstraints" yaml:"accessConstraints"`
67+
LayerLimit int `xml:"LayerLimit,omitempty" yaml:"layerLimit"`
68+
MaxWidth int `xml:"MaxWidth,omitempty" yaml:"maxWidth"`
69+
MaxHeight int `xml:"MaxHeight,omitempty" yaml:"maxHeight"`
70+
}
71+
72+
// ContactInformation struct containing the information about a contact person for the service
73+
type ContactInformation struct {
74+
ContactPersonPrimary ContactPersonPrimary `xml:"ContactPersonPrimary" yaml:"contactPersonPrimary"`
75+
ContactPosition string `xml:"ContactPosition" yaml:"contactPosition"`
76+
ContactAddress ContactAddress `xml:"ContactAddress" yaml:"contactAddress"`
77+
ContactVoiceTelephone string `xml:"ContactVoiceTelephone" yaml:"contactVoiceTelephone"`
78+
ContactFacsimileTelephone string `xml:"ContactFacsimileTelephone" yaml:"contactFacsimileTelephone"`
79+
ContactElectronicMailAddress string `xml:"ContactElectronicMailAddress" yaml:"contactElectronicMailAddress"`
80+
}
81+
82+
// ContactPersonPrimary struct containing information for the person to contact
83+
type ContactPersonPrimary struct {
84+
ContactPerson string `xml:"ContactPerson" yaml:"contactPerson"`
85+
ContactOrganization string `xml:"ContactOrganization" yaml:"contactOrganization"`
86+
}
87+
88+
// ContactAddress struct containing the address for the contact supplying the service
89+
type ContactAddress struct {
90+
AddressType string `xml:"AddressType" yaml:"addressType"`
91+
Address string `xml:"Address" yaml:"address"`
92+
City string `xml:"City" yaml:"city"`
93+
StateOrProvince string `xml:"StateOrProvince" yaml:"stateOrProvince"`
94+
PostalCode string `xml:"PostCode" yaml:"postalCode"`
95+
Country string `xml:"Country" yaml:"country"`
9196
}

0 commit comments

Comments
 (0)