comparison pkg/imports/bn.go @ 4102:3d2f02c16765 request_hist_bns

Request historic bottleneck data from SOAP service
author Tom Gottfried <tom@intevation.de>
date Fri, 26 Jul 2019 13:46:55 +0200
parents 5867dcf8e93c
children 861760675497
comparison
equal deleted inserted replaced
4101:7afe411eeb48 4102:3d2f02c16765
22 "regexp" 22 "regexp"
23 "strconv" 23 "strconv"
24 "strings" 24 "strings"
25 "time" 25 "time"
26 26
27 "gemma.intevation.de/gemma/pkg/common"
27 "gemma.intevation.de/gemma/pkg/pgxutils" 28 "gemma.intevation.de/gemma/pkg/pgxutils"
28 "gemma.intevation.de/gemma/pkg/soap/ifbn" 29 "gemma.intevation.de/gemma/pkg/soap/ifbn"
29 "github.com/jackc/pgx/pgtype" 30 "github.com/jackc/pgx/pgtype"
30 ) 31 )
31 32
293 ) (interface{}, error) { 294 ) (interface{}, error) {
294 295
295 fetch := func() ([]*ifbn.BottleNeckType, error) { 296 fetch := func() ([]*ifbn.BottleNeckType, error) {
296 client := ifbn.NewIBottleneckService(bn.URL, bn.Insecure, nil) 297 client := ifbn.NewIBottleneckService(bn.URL, bn.Insecure, nil)
297 298
298 req := &ifbn.Export_bn_by_isrs{} 299 req := &ifbn.Export_bn_by_isrs{
300 Period: &ifbn.RequestedPeriod{Date_start: &time.Time{}},
301 }
299 302
300 resp, err := client.Export_bn_by_isrs(req) 303 resp, err := client.Export_bn_by_isrs(req)
301 if err != nil { 304 if err != nil {
302 return nil, err 305 return nil, err
303 } 306 }
444 } 447 }
445 448
446 if t, ok := fromTo[toKey]; ok { 449 if t, ok := fromTo[toKey]; ok {
447 tto.Set(t) 450 tto.Set(t)
448 uBound = pgtype.Exclusive 451 uBound = pgtype.Exclusive
452 feedback.Info("Valid from %s to %s",
453 fromTo[fromKey].Format(common.TimeFormat),
454 fromTo[toKey].Format(common.TimeFormat))
449 } else { 455 } else {
450 uBound = pgtype.Unbounded 456 uBound = pgtype.Unbounded
457 feedback.Info("Valid from %s",
458 fromTo[fromKey].Format(common.TimeFormat))
451 } 459 }
452 } 460 }
453 461
454 validity := pgtype.Tstzrange{ 462 validity := pgtype.Tstzrange{
455 Lower: tfrom, 463 Lower: tfrom,