Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve tag fill by position and walk elements #22

Merged
merged 6 commits into from
Aug 23, 2024

Conversation

suqin-haha
Copy link
Contributor

make tag select by position value exclude from later match,
and add walkStructElementWithError

parsetag.go Outdated Show resolved Hide resolved
walkstruct.go Outdated Show resolved Hide resolved
@suqin-haha suqin-haha requested a review from muir August 21, 2024 21:52
walkstruct.go Outdated Show resolved Hide resolved
walkstruct.go Show resolved Hide resolved
@suqin-haha suqin-haha requested a review from muir August 22, 2024 18:42
walkstruct.go Outdated Show resolved Hide resolved
Co-authored-by: David Sharnoff <[email protected]>
@suqin-haha suqin-haha requested a review from muir August 23, 2024 00:31
@muir muir merged commit 026c49d into muir:main Aug 23, 2024
18 checks passed
@@ -176,6 +175,7 @@ func (tag Tag) Fill(model interface{}, opts ...FillOptArg) error {
return true
}
value = elements[i]
delete(kv, value) // exclude from rest match
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@muir This probably not good enough

for case

struct {
    	T6 bool   `xyz:"first,first" want:"{\"Name\":\"first\",\"First\":true}"`
        T7 bool   `xyz:"first,!first" want:"{\"Name\":\"first\",\"First\":false}"`
}

with this line delete(kv, value) will make second first never match. But without this line, will make the second first always match.

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