Skip to content

Add nulls.ValidInt64Count helper - #1364

Closed
soumajitgh wants to merge 1 commit into
OneBusAway:mainfrom
soumajitgh:extract/nulls-valid-int64-count
Closed

Add nulls.ValidInt64Count helper#1364
soumajitgh wants to merge 1 commit into
OneBusAway:mainfrom
soumajitgh:extract/nulls-valid-int64-count

Conversation

@soumajitgh

@soumajitgh soumajitgh commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add nulls.ValidInt64Count, a small helper that counts how many sql.NullInt64 values in a variadic list are valid.

Context

Extracted from #1343 ("Add frequency-based schedule-for-stop service"). That PR's schedule_for_stop_handler.go changes collide with the in-flight #1348 ("GTFS Frequencies Phase 3"), which is taking over that file. This helper has no dependency on the rest of #1343's changes and is general-purpose (counting valid frequency-row fields to decide whether a row is usable), so it's being carved out on its own rather than getting lost when #1343 closes.

Validation

  • go vet -tags "sqlite_fts5 sqlite_math_functions" ./...
  • go vet -tags "purego" ./...
  • make test
  • go fmt ./...

Summary by CodeRabbit

  • New Features

    • Added support for counting valid numeric values while ignoring null entries.
  • Tests

    • Added coverage to verify accurate counting when valid and null values are mixed.

Frequency-based schedule expansion needs to know how many of a
frequency row's optional fields (headway, start/end time, exact_times)
are actually populated before treating the row as valid. Extracted
from PR OneBusAway#1343 as a standalone, general-purpose helper since it has no
dependency on the rest of that PR's schedule-for-stop changes.
@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0f56091d-fd0a-438e-9bed-9c0d8c70f458

📥 Commits

Reviewing files that changed from the base of the PR and between 710c211 and c64ad7b.

📒 Files selected for processing (2)
  • internal/nulls/database.go
  • internal/nulls/database_test.go

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The nulls package adds ValidInt64Count to count valid sql.NullInt64 values. A test verifies the count for two valid values and one invalid value.

Changes

Nullable integer count

Layer / File(s) Summary
Valid integer count helper and validation
internal/nulls/database.go, internal/nulls/database_test.go
ValidInt64Count counts values with Valid set to true. TestValidInt64Count verifies the result for two valid values and one invalid value.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Merge Risk: ⚪ Minimal · up to c64ad

This localized helper adds valid-value counting behavior with no actionable merge-blocking risk remaining after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding the nulls.ValidInt64Count helper.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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