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

coder / slog / 9df5e0a6c14572480711c6c06dd26ceabe32ad72
96%

Build:
DEFAULT BRANCH: main
Ran 03 Jul 2025 07:43AM UTC
Jobs 1
Files 11
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

03 Jul 2025 07:42AM UTC coverage: 96.822% (-0.2%) from 97.044%
9df5e0a6c14572480711c6c06dd26ceabe32ad72

push

github

web-flow
fix!: handle `sql/driver.Valuer` types properly in `slogjson` (#219)

Currently, if a field like `sql.NullInt32` has `Valid: False`, `sloghuman` will export it's value as `<nil>`, regardless of it's `String`.
This is because it checks `(driver.Valuer).Value()`.

However, `slogjson` currently sets the value to the json string of the raw struct:
```json
{
  "fields": {
      "Code": "{Int32:0 Valid:false}",
      "ValidCode": "{Int32:12 Valid:true}"
  }
}
```

This PR handles this case by first checking if the type implements `sql/driver.Valuer`. If `Valid` is `false` then a JSON `null` value is produced:
```json
{
  "fields": {
      "Code": null,
      "ValidCode": 12
  }
}
```
This matches the behaviour of `sloghuman`.

This is technically a breaking change, as these types are now `T | null` instead of `String`, where `T` is the corresponding JSON type of `sql.Null<V>`

4 of 6 new or added lines in 1 file covered. (66.67%)

792 of 818 relevant lines covered (96.82%)

22.34 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
2
98.36
-1.64% map.go
Jobs
ID Job ID Ran Files Coverage
1 9df5e0a6c14572480711c6c06dd26ceabe32ad72.1 03 Jul 2025 07:43AM UTC 11
96.82
GitHub Action Run
Source Files on build 9df5e0a6c14572480711c6c06dd26ceabe32ad72
  • Tree
  • List 11
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 9df5e0a6 on github
  • Prev Build on main (#0EC81E6E...)
  • Next Build on main (#40FF1993...)
  • Delete
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