Mercurial > gemma
comparison pkg/models/isrs.go @ 5601:1222b777f51f
Made golint finally happy.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sat, 06 Aug 2022 02:09:57 +0200 |
parents | 15c9d4064f0f |
children |
comparison
equal
deleted
inserted
replaced
5600:9967a78e43f4 | 5601:1222b777f51f |
---|---|
28 FairwaySection string | 28 FairwaySection string |
29 Orc string | 29 Orc string |
30 Hectometre int | 30 Hectometre int |
31 } | 31 } |
32 | 32 |
33 // UnmarshalJSON implements the json.Unmarshaler interface. | |
33 func (isrs *Isrs) UnmarshalJSON(data []byte) error { | 34 func (isrs *Isrs) UnmarshalJSON(data []byte) error { |
34 var s string | 35 var s string |
35 if err := json.Unmarshal(data, &s); err != nil { | 36 if err := json.Unmarshal(data, &s); err != nil { |
36 return err | 37 return err |
37 } | 38 } |
41 } | 42 } |
42 *isrs = *in | 43 *isrs = *in |
43 return nil | 44 return nil |
44 } | 45 } |
45 | 46 |
47 // Less orders two Isrs codes. | |
46 func (isrs *Isrs) Less(other *Isrs) bool { | 48 func (isrs *Isrs) Less(other *Isrs) bool { |
47 if isrs.CountryCode < other.CountryCode { | 49 if isrs.CountryCode < other.CountryCode { |
48 return true | 50 return true |
49 } | 51 } |
50 if isrs.CountryCode > other.CountryCode { | 52 if isrs.CountryCode > other.CountryCode { |
72 return true | 74 return true |
73 } | 75 } |
74 return false | 76 return false |
75 } | 77 } |
76 | 78 |
79 // MarshalJSON implements the json.Marshaler interface. | |
77 func (isrs *Isrs) MarshalJSON() ([]byte, error) { | 80 func (isrs *Isrs) MarshalJSON() ([]byte, error) { |
78 if isrs == nil { | 81 if isrs == nil { |
79 return nil, nil | 82 return nil, nil |
80 } | 83 } |
81 return json.Marshal(isrs.String()) | 84 return json.Marshal(isrs.String()) |