• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rm-hull / fuel-prices-api / 22199881476

19 Feb 2026 08:59PM UTC coverage: 28.826% (+0.2%) from 28.595%
22199881476

push

github

web-flow
feat: add import command and data cleansing (#10)

* feat: add import command and data cleansing

This change introduces a new `import` CLI command to allow manual
one-off data synchronization from the GOV.UK API. It also improves data
consistency by cleansing address strings and normalizing fuel prices.

*   Added `import` command to the CLI.
*   Refactored shared initialization into a `bootstrap` function.
*   Implemented `cleanseAddressLine1` to remove redundant city and
    postcode suffixes.
*   Implemented `cleansePrice` to normalize prices provided in pounds
    or tenths of pence into standard pence.
*   Updated `ApiServer` to return errors instead of terminating the
    process directly.
*   Added **health check** and **metrics** endpoints to `test_api.http`.

```mermaid
sequenceDiagram
    participant CLI as main.go
    participant Cmd as cmd/import.go
    participant Boot as cmd/bootstrap.go
    participant Client as internal.FuelPricesClient
    participant Repo as internal.FuelPricesRepository

    CLI->>Cmd: Import()
    Cmd->>Boot: bootstrap(dbPath)
    Boot-->>Cmd: client, repo
    Cmd->>Client: GetFillingStations(repo.InsertPFS)
    Client->>Repo: InsertPFS(batch)
    Cmd->>Client: GetFuelPrices(repo.InsertPrices)
    Client->>Repo: InsertPrices(batch)
    Cmd->>Repo: Close()
```

* refactor: use strings.TrimSuffix in address cleansing

Replace manual suffix checking and replacement with the more idiomatic
`strings.TrimSuffix` function. This improves readability and ensures
only the end of the string is targeted.

23 of 100 new or added lines in 6 files covered. (23.0%)

2 existing lines in 2 files now uncovered.

194 of 673 relevant lines covered (28.83%)

0.31 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/cmd/api_server.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc