Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@k4n4ry
Copy link

@k4n4ry k4n4ry commented Dec 30, 2025

fix #472

Added a new qrm configuration flag StrictFieldMapping to detect destination struct fields (single-column mapped fields only) that have no matching columns in the SQL result set and panic when enabled.
Updated tests/sqlite to allow per-test toggling and added test cases verifying the behavior for full-column vs partial-column SELECTs under StrictFieldMapping on/off.

@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

❌ Patch coverage is 92.72727% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.22%. Comparing base (adef2f9) to head (80b4ddd).

Files with missing lines Patch % Lines
qrm/scan_context.go 91.83% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #542      +/-   ##
==========================================
+ Coverage   92.19%   92.22%   +0.02%     
==========================================
  Files         139      139              
  Lines        8584     8638      +54     
==========================================
+ Hits         7914     7966      +52     
- Misses        493      495       +2     
  Partials      177      177              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@k4n4ry k4n4ry force-pushed the feat/strict-field-mapping branch from b163c23 to f33c2ee Compare December 30, 2025 12:00
Comment on lines +24 to +25
// This check applies only to fields that are mapped from a single column (simple/scanner/json_column).
// Complex fields (struct/slice) are excluded because they are not mapped from a single column.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ These two comment lines are outdated now, aren't they?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, those two lines can be removed.

Copy link
Author

@k4n4ry k4n4ry Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think those two comment lines are still valid.

https://github.com/go-jet/jet/pull/542/files#diff-809b76e4dcf142a15597861733757190fe8926c2d40edd1905f7a900859dbd54R131-R133

	if fieldMap.Type == complexType {
		return false
	}

The purpose of qrm:"optional" is simply to suppress unmapped-field reporting for fields under an optional parent (often a complex struct/slice field), not to make complexType fields themselves part of the StrictFieldMapping checks. If I’m misunderstanding anything, please let me know.

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.

Feature request: extend Strict Scan mode to also detect unmapped struct fields

3 participants