Skip to content

Commit

Permalink
Move constructor close to struct
Browse files Browse the repository at this point in the history
  • Loading branch information
Lun4m committed Dec 2, 2024
1 parent c5046e6 commit 090da78
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions migrations/kvalobs/import/cache/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ type Cache struct {
Permits lard.PermitMaps
}

func New(kvalobs db.DB) *Cache {
permits := lard.NewPermitTables()
timespans := cacheKvalobsTimeseriesTimespans(kvalobs)
return &Cache{Permits: permits, Meta: timespans}
}

func (c *Cache) GetSeriesTimespan(label *db.Label) (utils.TimeSpan, error) {
// First try to lookup timespan with both stationid and paramid
// TODO: should these timespans modify an existing timeseries in lard?
Expand Down Expand Up @@ -53,12 +59,6 @@ type MetaKey struct {
Paramid sql.NullInt32
}

func New(kvalobs db.DB) *Cache {
permits := lard.NewPermitTables()
timespans := cacheKvalobsTimeseriesTimespans(kvalobs)
return &Cache{Permits: permits, Meta: timespans}
}

// Query kvalobs `station_metadata` table that stores timeseries timespans
func cacheKvalobsTimeseriesTimespans(kvalobs db.DB) KvalobsTimespan {
cache := make(KvalobsTimespan)
Expand Down

0 comments on commit 090da78

Please sign in to comment.