Mercurial > gemma
diff pkg/geoserver/boot.go @ 5712:6270951dda28 revive-cleanup
/interface{}/any/
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 20 Feb 2024 22:37:51 +0100 |
parents | 5f47eeea988d |
children |
line wrap: on
line diff
--- a/pkg/geoserver/boot.go Tue Feb 20 22:22:57 2024 +0100 +++ b/pkg/geoserver/boot.go Tue Feb 20 22:37:51 2024 +0100 @@ -50,7 +50,7 @@ } } -func toStream(x interface{}) io.Reader { +func toStream(x any) io.Reader { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(x); err != nil { @@ -62,7 +62,7 @@ // XXX: Creating SQL views with JSON via GeoServer REST-API fails // Begin code for handling with XML instead -func toXMLStream(x interface{}) io.Reader { +func toXMLStream(x any) io.Reader { buf := bytes.NewBufferString(xml.Header) if err := xml.NewEncoder(buf).Encode(x); err != nil { // Should not happen @@ -166,15 +166,15 @@ log.Infoln("creating datastore " + datastoreName) type entry struct { - Key interface{} `json:"@key"` - Value interface{} `json:"$"` + Key any `json:"@key"` + Value any `json:"$"` } // Create datastore. - ds := map[string]interface{}{ - "dataStore": map[string]interface{}{ + ds := map[string]any{ + "dataStore": map[string]any{ "name": datastoreName, - "connectionParameters": map[string]interface{}{ + "connectionParameters": map[string]any{ "entry": []entry{ {"host", config.DBHost()}, {"port", config.DBPort()}, @@ -301,7 +301,7 @@ var req *http.Request - ft := map[string]interface{}{ + ft := map[string]any{ "name": table, "nativeName": table, "title": table, @@ -310,7 +310,7 @@ ft["srs"] = *srs // A bit of a hack! if *srs == "EPSG:4326" { - box := map[string]interface{}{ + box := map[string]any{ "minx": -180, "maxx": +180, "miny": -90, @@ -322,17 +322,17 @@ } } - var entries []map[string]interface{} + var entries []map[string]any if models.IntSQLView(tables[i]) { - vt := map[string]interface{}{ + vt := map[string]any{ "name": table, "sql": *tables[i].SQL, } if kc := tables[i].KeyColumn; kc != nil { vt["keyColumn"] = *kc } - entry := map[string]interface{}{ + entry := map[string]any{ "@key": "JDBC_VIRTUAL_TABLE", "virtualTable": vt, } @@ -340,7 +340,7 @@ } if attr := tables[i].WMSTAttribute; attr != nil { - di := map[string]interface{}{ + di := map[string]any{ "enabled": true, "attribute": *attr, "presentation": "CONTINUOUS_INTERVAL", @@ -354,7 +354,7 @@ if endAttr := tables[i].WMSTEndAttribute; endAttr != nil { di["endAttribute"] = *endAttr } - entry := map[string]interface{}{ + entry := map[string]any{ "@key": "time", "dimensionInfo": di, } @@ -362,12 +362,12 @@ } if len(entries) > 0 { - ft["metadata"] = map[string]interface{}{ + ft["metadata"] = map[string]any{ "entry": entries, } } - doc := map[string]interface{}{ + doc := map[string]any{ "featureType": ft, }