diff pkg/models/intservices.go @ 4673:443867b548b5

Fix identifiers in layers generated from SQL views
author Tom Gottfried <tom@intevation.de>
date Tue, 15 Oct 2019 15:59:38 +0200
parents b5aa1eb83bb0
children 4a9a1e323e11
line wrap: on
line diff
--- a/pkg/models/intservices.go	Tue Oct 15 15:55:12 2019 +0200
+++ b/pkg/models/intservices.go	Tue Oct 15 15:59:38 2019 +0200
@@ -28,13 +28,14 @@
 const DatabaseScheme = "waterway"
 
 type IntEntry struct {
-	Schema string  `json:"schema"`
-	Name   string  `json:"name"`
-	SQL    *string `json:"sql"`
-	SRS    *string `json:"srs"`
-	Style  bool    `json:"style"`
-	WMS    bool    `json:"wms"`
-	WFS    bool    `json:"wfs"`
+	Schema    string  `json:"schema"`
+	Name      string  `json:"name"`
+	SQL       *string `json:"sql"`
+	KeyColumn *string `json:"keycolumn"`
+	SRS       *string `json:"srs"`
+	Style     bool    `json:"style"`
+	WMS       bool    `json:"wms"`
+	WFS       bool    `json:"wfs"`
 }
 
 type IntServices struct {
@@ -45,7 +46,7 @@
 const (
 	selectServicesSQL = `
 SELECT schema, name,
-  view_def, auth_name || ':' || auth_srid,
+  view_def, key_column, auth_name || ':' || auth_srid,
   style IS NOT NULL, as_wms, as_wfs
 FROM sys_admin.published_services
   LEFT JOIN spatial_ref_sys USING (srid)
@@ -141,7 +142,7 @@
 				var entry IntEntry
 				if err := rows.Scan(
 					&entry.Schema, &entry.Name,
-					&entry.SQL, &entry.SRS, &entry.Style,
+					&entry.SQL, &entry.KeyColumn, &entry.SRS, &entry.Style,
 					&entry.WMS, &entry.WFS,
 				); err != nil {
 					return err