Skip to content

feat: add OrNull constructors#1

Merged
kolkov merged 1 commit into
mainfrom
feat/ornull-constructors
Jul 4, 2026
Merged

feat: add OrNull constructors#1
kolkov merged 1 commit into
mainfrom
feat/ornull-constructors

Conversation

@kolkov

@kolkov kolkov commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Generic OrNull[T comparable] — zero value → null mapping for any comparable type
  • 8 typed constructors: StringOrNull, IntOrNull, Int32OrNull, Int16OrNull, FloatOrNull, BoolOrNull, ByteOrNull, TimeOrNull
  • Eliminates boilerplate optStr()/optInt() helpers in DB/API projects

Documentation

  • README.md: OrNull added to Constructors section
  • CHANGELOG.md: v0.2.0 section
  • ROADMAP.md: updated to v0.2.0
  • AGENTS.md: updated examples
  • doc.go: OrNull mentioned
  • example_test.go: ExampleStringOrNull, ExampleOrNull

Test plan

  • TestOrNull_Generic — int, string zero/non-zero
  • TestStringOrNull — empty/non-empty
  • TestIntOrNull — 0/42/-1
  • TestInt32OrNull, TestInt16OrNull — 0/42
  • TestFloatOrNull — 0.0/3.14
  • TestBoolOrNull — false(null)/true(valid)
  • TestByteOrNull — 0/42
  • TestTimeOrNull — zero time/now
  • All existing tests pass (no regressions)
  • go vet clean, gofmt clean

Generic OrNull[T] + typed constructors: StringOrNull, IntOrNull,
Int32OrNull, Int16OrNull, FloatOrNull, BoolOrNull, ByteOrNull, TimeOrNull.

Eliminates boilerplate helpers in DB/API projects.
@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

@kolkov kolkov merged commit 0f3d14f into main Jul 4, 2026
15 checks passed
@kolkov kolkov deleted the feat/ornull-constructors branch July 4, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant