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

Skip to content

Conversation

@charmfocus
Copy link
Contributor

No description provided.

@kevwan
Copy link
Contributor

kevwan commented Jul 17, 2025

Thanks for your contribution! Please add unit tests.

@codecov
Copy link

codecov bot commented Jul 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@charmfocus
Copy link
Contributor Author

charmfocus commented Jul 18, 2025

Thanks for your contribution! Please add unit tests.

Thanks! I've added unit tests.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for skipping struct fields during SQL unmarshaling by introducing field tag (-) skip logic in the unwrapFields function. This allows developers to exclude specific struct fields from database mapping operations.

  • Adds field skipping logic using db:"-" tag in the unwrapFields function
  • Implements comprehensive test coverage for both single row and multiple rows scenarios with ignored fields

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
core/stores/sqlx/orm.go Adds skip logic to check for - tag and continue to next field if found
core/stores/sqlx/orm_test.go Adds test cases validating field skipping behavior for both unmarshalRow and unmarshalRows functions
Comments suppressed due to low confidence (2)

core/stores/sqlx/orm_test.go:1036

  • [nitpick] The variable name 'expect' should be renamed to 'expected' or 'expectedValues' to be more descriptive and follow Go naming conventions.
	expect := []struct {

core/stores/sqlx/orm_test.go:1080

  • [nitpick] The variable name 'each' should be renamed to something more descriptive like 'expectedItem' or 'expectedValue' to improve code readability.
		for i, each := range expect {

@kevwan kevwan added this pull request to the merge queue Jul 18, 2025
Merged via the queue into zeromicro:master with commit cc79e3d Jul 18, 2025
6 checks passed
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.

2 participants