Mercurial > gemma
comparison pkg/octree/tin.go @ 1328:d753ce6cf588
To make golint happier made context.Context to be the first argument in all calls.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sun, 25 Nov 2018 16:26:41 +0100 |
parents | a244b18cb916 |
children | 84e78d2e2d95 |
comparison
equal
deleted
inserted
replaced
1327:cabf4789e02b | 1328:d753ce6cf588 |
---|---|
21 "errors" | 21 "errors" |
22 "fmt" | 22 "fmt" |
23 "io" | 23 "io" |
24 "log" | 24 "log" |
25 "math" | 25 "math" |
26 "time" | |
27 ) | 26 ) |
28 | 27 |
29 var ( | 28 var ( |
30 errNoByteSlice = errors.New("Not a byte slice") | 29 errNoByteSlice = errors.New("Not a byte slice") |
31 errTooLessPoints = errors.New("Too less points") | 30 errTooLessPoints = errors.New("Too less points") |
197 FROM trans) t | 196 FROM trans) t |
198 ) | 197 ) |
199 SELECT ST_AsBinary(ST_Collect(triangles.geom)) FROM triangles, trans | 198 SELECT ST_AsBinary(ST_Collect(triangles.geom)) FROM triangles, trans |
200 WHERE ST_Covers(trans.area, triangles.poly)` | 199 WHERE ST_Covers(trans.area, triangles.poly)` |
201 | 200 |
202 loadTinSQL = tinSQLPrefix + `WHERE bottleneck_id = $2 AND date_info = $3` + tinSQLSuffix | |
203 loadTinByIDSQL = tinSQLPrefix + `WHERE id = $2` + tinSQLSuffix | 201 loadTinByIDSQL = tinSQLPrefix + `WHERE id = $2` + tinSQLSuffix |
204 ) | 202 ) |
205 | 203 |
206 func GenerateTin( | 204 func GenerateTinByID( |
205 ctx context.Context, | |
207 conn *sql.Conn, | 206 conn *sql.Conn, |
208 ctx context.Context, | |
209 bottleneck string, | |
210 date time.Time, | |
211 epsg uint32, | |
212 ) (*Tin, error) { | |
213 var tin Tin | |
214 err := conn.QueryRowContext(ctx, loadTinSQL, epsg, bottleneck, date).Scan(&tin) | |
215 switch { | |
216 case err == sql.ErrNoRows: | |
217 return nil, nil | |
218 case err != nil: | |
219 return nil, err | |
220 } | |
221 tin.EPSG = epsg | |
222 return &tin, nil | |
223 } | |
224 | |
225 func GenerateTinByID( | |
226 conn *sql.Conn, | |
227 ctx context.Context, | |
228 id int64, | 207 id int64, |
229 epsg uint32, | 208 epsg uint32, |
230 ) (*Tin, error) { | 209 ) (*Tin, error) { |
231 var tin Tin | 210 var tin Tin |
232 err := conn.QueryRowContext(ctx, loadTinByIDSQL, epsg, id).Scan(&tin) | 211 err := conn.QueryRowContext(ctx, loadTinByIDSQL, epsg, id).Scan(&tin) |