Mercurial > gemma
annotate pkg/controllers/common.go @ 3678:8f58851927c0
client: make layer factory only return new layer config for individual maps
instead of each time it is invoked. The purpose of the factory was to support multiple maps with individual layers.
But returning a new config each time it is invoked leads to bugs that rely on the layer's state. Now this factory
reuses the same objects it created before, per map.
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Mon, 17 Jun 2019 17:31:35 +0200 |
parents | 4c254651d80b |
children | 6521c962a7b6 |
rev | line source |
---|---|
3190
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 // This is Free Software under GNU Affero General Public License v >= 3.0 |
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 // without warranty, see README.md and license for details. |
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 // |
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 // SPDX-License-Identifier: AGPL-3.0-or-later |
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 // License-Filename: LICENSES/AGPL-3.0.txt |
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 // |
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 // Copyright (C) 2019 by via donau |
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 // – Österreichische Wasserstraßen-Gesellschaft mbH |
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 // Software engineering by Intevation GmbH |
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 // |
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 // Author(s): |
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 // * Sascha L. Teichmann <sascha.teichmann@intevation.de> |
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 |
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 package controllers |
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 |
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 import ( |
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 "fmt" |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
18 "log" |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
19 "strconv" |
3190
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 "strings" |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
21 |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
22 "github.com/jackc/pgx/pgtype" |
3190
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 ) |
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 |
3194
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
25 type ( |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
26 filterNode interface { |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
27 serialize(*strings.Builder, *[]interface{}) |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
28 } |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
29 |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
30 filterTerm struct { |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
31 format string |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
32 args []interface{} |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
33 } |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
34 |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
35 filterNot struct { |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
36 filterNode |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
37 } |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
38 |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
39 filterAnd []filterNode |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
40 filterOr []filterNode |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
41 ) |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
42 |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
43 func (ft *filterTerm) serialize(stmt *strings.Builder, args *[]interface{}) { |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
44 indices := make([]interface{}, len(ft.args)) |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
45 for i := range indices { |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
46 indices[i] = len(*args) + i + 1 |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
47 } |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
48 fmt.Fprintf(stmt, ft.format, indices...) |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
49 *args = append(*args, (*ft).args...) |
3190
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 } |
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 |
3194
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
52 func buildFilterTerm(format string, args ...interface{}) *filterTerm { |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
53 return &filterTerm{format: format, args: args} |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
54 } |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
55 |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
56 func (fa filterAnd) serialize(stmt *strings.Builder, args *[]interface{}) { |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
57 for i, node := range fa { |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
58 if i > 0 { |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
59 stmt.WriteString(" AND ") |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
60 } |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
61 stmt.WriteByte('(') |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
62 node.serialize(stmt, args) |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
63 stmt.WriteByte(')') |
3190
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 } |
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 } |
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 |
3194
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
67 func (fo filterOr) serialize(stmt *strings.Builder, args *[]interface{}) { |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
68 for i, node := range fo { |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
69 if i > 0 { |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
70 stmt.WriteString(" OR ") |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
71 } |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
72 stmt.WriteByte('(') |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
73 node.serialize(stmt, args) |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
74 stmt.WriteByte(')') |
3190
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 } |
54a3e40cfbed
controllers: moved filter builder to a separate file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 } |
3194
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
77 |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
78 func (fn *filterNot) serialize(stmt *strings.Builder, args *[]interface{}) { |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
79 stmt.WriteString("NOT (") |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
80 fn.filterNode.serialize(stmt, args) |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
81 stmt.WriteByte(')') |
eeff2cc4ff9d
controllers: re-factored the SQL filter to a tree like structure to be of more general use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3190
diff
changeset
|
82 } |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
83 |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
84 func toInt8Array(txt string) *pgtype.Int8Array { |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
85 parts := strings.Split(txt, ",") |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
86 var ints []int64 |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
87 for _, part := range parts { |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
88 part = strings.TrimSpace(part) |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
89 v, err := strconv.ParseInt(part, 10, 64) |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
90 if err != nil { |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
91 continue |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
92 } |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
93 ints = append(ints, v) |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
94 } |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
95 var ia pgtype.Int8Array |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
96 if err := ia.Set(ints); err != nil { |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
97 log.Printf("warn: %v\n", err) |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
98 return nil |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
99 } |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
100 return &ia |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
101 } |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
102 |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
103 func toTextArray(txt string, allowed []string) *pgtype.TextArray { |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
104 parts := strings.Split(txt, ",") |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
105 var accepted []string |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
106 for _, part := range parts { |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
107 if part = strings.ToLower(strings.TrimSpace(part)); len(part) == 0 { |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
108 continue |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
109 } |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
110 for _, a := range allowed { |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
111 if part == a { |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
112 accepted = append(accepted, part) |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
113 break |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
114 } |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
115 } |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
116 } |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
117 if len(accepted) == 0 { |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
118 return nil |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
119 } |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
120 var ta pgtype.TextArray |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
121 if err := ta.Set(accepted); err != nil { |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
122 log.Printf("warn: %v\n", err) |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
123 return nil |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
124 } |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
125 return &ta |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3194
diff
changeset
|
126 } |