v0.0.512
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 5m6s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 5m6s
This commit is contained in:
parent
d7fbef37db
commit
1f456c5134
@ -1,5 +1,5 @@
|
||||
package goext
|
||||
|
||||
const GoextVersion = "0.0.511"
|
||||
const GoextVersion = "0.0.512"
|
||||
|
||||
const GoextVersionTimestamp = "2024-09-15T18:22:07+0200"
|
||||
const GoextVersionTimestamp = "2024-09-15T21:25:21+0200"
|
||||
|
@ -788,7 +788,7 @@ FieldLoop:
|
||||
|
||||
if f.omitEmpty && isEmptyValue(fv) {
|
||||
continue
|
||||
} else if opts.filter != nil && !matchesJSONFilter(f.jsonfilter, *opts.filter) {
|
||||
} else if !matchesJSONFilter(f.jsonfilter, opts.filter) {
|
||||
continue
|
||||
}
|
||||
e.WriteByte(next)
|
||||
@ -808,16 +808,20 @@ FieldLoop:
|
||||
}
|
||||
}
|
||||
|
||||
func matchesJSONFilter(filter jsonfilter, value string) bool {
|
||||
func matchesJSONFilter(filter jsonfilter, value *string) bool {
|
||||
if len(filter) == 0 {
|
||||
return true
|
||||
return true // no filter in struct
|
||||
}
|
||||
|
||||
if value == nil || *value == "" {
|
||||
return false // no filter set, but struct has filter, return false
|
||||
}
|
||||
|
||||
if len(filter) == 1 && filter[0] == "-" {
|
||||
return false
|
||||
}
|
||||
|
||||
if filter.Contains(value) {
|
||||
if filter.Contains(*value) {
|
||||
return true
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user