Mercurial > gemma
annotate pkg/models/surveys.go @ 2149:ed0ee54fc49e
Extend /surveys endpoint to include waterlevel_value
* Change SQL to use the same strategy as used in schema/gemma.sql
for bottlenecks_geoserver to determine the waterlevel_value.
* Extend go controler to deal with the situation where the value is not
there. This is still suboptimal as this creates a json object for
the NullInt64 value.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Fri, 08 Feb 2019 11:26:05 +0100 |
parents | 7267f8168176 |
children | 8132434f4093 |
rev | line source |
---|---|
1017
a244b18cb916
Added GNU Affero General Public License.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
812
diff
changeset
|
1 // This is Free Software under GNU Affero General Public License v >= 3.0 |
a244b18cb916
Added GNU Affero General Public License.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
812
diff
changeset
|
2 // without warranty, see README.md and license for details. |
a244b18cb916
Added GNU Affero General Public License.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
812
diff
changeset
|
3 // |
a244b18cb916
Added GNU Affero General Public License.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
812
diff
changeset
|
4 // SPDX-License-Identifier: AGPL-3.0-or-later |
a244b18cb916
Added GNU Affero General Public License.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
812
diff
changeset
|
5 // License-Filename: LICENSES/AGPL-3.0.txt |
a244b18cb916
Added GNU Affero General Public License.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
812
diff
changeset
|
6 // |
2129
8f6345ad5f13
Extend /surveys/ endpoint to include reference gauge
Bernhard Reiter <bernhard@intevation.de>
parents:
1332
diff
changeset
|
7 // Copyright (C) 2018, 2019 by via donau |
1017
a244b18cb916
Added GNU Affero General Public License.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
812
diff
changeset
|
8 // – Österreichische Wasserstraßen-Gesellschaft mbH |
a244b18cb916
Added GNU Affero General Public License.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
812
diff
changeset
|
9 // Software engineering by Intevation GmbH |
a244b18cb916
Added GNU Affero General Public License.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
812
diff
changeset
|
10 // |
a244b18cb916
Added GNU Affero General Public License.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
812
diff
changeset
|
11 // Author(s): |
a244b18cb916
Added GNU Affero General Public License.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
812
diff
changeset
|
12 // * Sascha Wilde <sascha.wilde@intevation.de> |
a244b18cb916
Added GNU Affero General Public License.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
812
diff
changeset
|
13 |
812
98a7776100fb
Added end point lo list available surveys for a given bottleneck.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
14 package models |
98a7776100fb
Added end point lo list available surveys for a given bottleneck.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
15 |
2149
ed0ee54fc49e
Extend /surveys endpoint to include waterlevel_value
Bernhard Reiter <bernhard@intevation.de>
parents:
2146
diff
changeset
|
16 import ( |
ed0ee54fc49e
Extend /surveys endpoint to include waterlevel_value
Bernhard Reiter <bernhard@intevation.de>
parents:
2146
diff
changeset
|
17 "database/sql" |
ed0ee54fc49e
Extend /surveys endpoint to include waterlevel_value
Bernhard Reiter <bernhard@intevation.de>
parents:
2146
diff
changeset
|
18 ) |
ed0ee54fc49e
Extend /surveys endpoint to include waterlevel_value
Bernhard Reiter <bernhard@intevation.de>
parents:
2146
diff
changeset
|
19 |
812
98a7776100fb
Added end point lo list available surveys for a given bottleneck.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
20 type ( |
98a7776100fb
Added end point lo list available surveys for a given bottleneck.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
21 Survey struct { |
2149
ed0ee54fc49e
Extend /surveys endpoint to include waterlevel_value
Bernhard Reiter <bernhard@intevation.de>
parents:
2146
diff
changeset
|
22 BottleneckID string `json:"bottleneck_id"` |
ed0ee54fc49e
Extend /surveys endpoint to include waterlevel_value
Bernhard Reiter <bernhard@intevation.de>
parents:
2146
diff
changeset
|
23 DateInfo string `json:"date_info"` |
ed0ee54fc49e
Extend /surveys endpoint to include waterlevel_value
Bernhard Reiter <bernhard@intevation.de>
parents:
2146
diff
changeset
|
24 DepthReference string `json:"depth_reference"` |
ed0ee54fc49e
Extend /surveys endpoint to include waterlevel_value
Bernhard Reiter <bernhard@intevation.de>
parents:
2146
diff
changeset
|
25 ReferenceGauge string `json:"gauge_objname"` |
ed0ee54fc49e
Extend /surveys endpoint to include waterlevel_value
Bernhard Reiter <bernhard@intevation.de>
parents:
2146
diff
changeset
|
26 WaterLevelValue sql.NullInt64 `json:"waterlevel_value"` |
812
98a7776100fb
Added end point lo list available surveys for a given bottleneck.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
27 } |
98a7776100fb
Added end point lo list available surveys for a given bottleneck.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
28 ) |