v0.0.492
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 5m32s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 5m32s
This commit is contained in:
@@ -788,7 +788,7 @@ FieldLoop:
|
||||
|
||||
if f.omitEmpty && isEmptyValue(fv) {
|
||||
continue
|
||||
} else if opts.filter != nil && len(f.jsonfilter) > 0 && !f.jsonfilter.Contains(*opts.filter) {
|
||||
} else if opts.filter != nil && !matchesJSONFilter(f.jsonfilter, *opts.filter) {
|
||||
continue
|
||||
}
|
||||
e.WriteByte(next)
|
||||
@@ -808,6 +808,26 @@ FieldLoop:
|
||||
}
|
||||
}
|
||||
|
||||
func matchesJSONFilter(filter jsonfilter, value string) bool {
|
||||
if len(filter) == 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
if len(filter) == 1 && filter[0] == "-" {
|
||||
return false
|
||||
}
|
||||
|
||||
if filter.Contains(value) {
|
||||
return true
|
||||
}
|
||||
|
||||
if filter.Contains("*") {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func newStructEncoder(t reflect.Type, tagkey string) encoderFunc {
|
||||
se := structEncoder{fields: cachedTypeFields(t, tagkey)}
|
||||
return se.encode
|
||||
|
Reference in New Issue
Block a user