func (m MaskInverse) Filter(fieldName string) (FieldFilter, bool) {
	subFilter, ok := m[fieldName]
	if !ok {
		return MaskInverse{}, !strings.HasPrefix(fieldName, "XXX_")
	}
	if subFilter == nil {
		return nil, false
	}
	return subFilter, !subFilter.IsEmpty()
}
Filter returns true for those fieldNames that do NOT exist in the underlying map.
Field names that start with "XXX_" are ignored as unexported.
package fieldmask_utils
import (
	"fmt"
	"strings"
	"github.com/pkg/errors"
	"google.golang.org/genproto/protobuf/field_mask"
)
type FieldFilter interface {
	Filter(fieldName string) (FieldFilter, bool)
	IsEmpty() bool
}
type FieldFilterContainer interface {
	FieldFilter
	Get(fieldName string) (filter FieldFilterContainer, result bool)
	Set(fieldName string, filter FieldFilterContainer)
}
type Mask map[string]FieldFilterContainer
func (m Mask) Get(fieldName string) (FieldFilterContainer, bool) {
	f, ok := m[fieldName]
	return f, ok
}
func (m Mask) Set(fieldName string, filter FieldFilterContainer) {
	m[fieldName] = filter
}
var _ FieldFilter = Mask{}
func (m Mask) Filter(fieldName string) (FieldFilter, bool) {
	if len(m) == 0 {
		return Mask{}, !strings.HasPrefix(fieldName, "XXX_")
	}
	subFilter, ok := m[fieldName]
	if !ok {
		subFilter = Mask{}
	}
	return subFilter, ok
}
func (m Mask) IsEmpty() bool {
	return len(m) == 0
}
func mapToString(m map[string]FieldFilterContainer) string {
	if len(m) == 0 {
		return ""
	}
	var result []string
	for fieldName, maskNode := range m {
		r := fieldName
		var sub string
		if stringer, ok := maskNode.(fmt.Stringer); ok {
			sub = stringer.String()
		} else {
			sub = fmt.Sprint(maskNode)
		}
		if sub != "" {
			r += "{" + sub + "}"
		}
		result = append(result, r)
	}
	return strings.Join(result, ",")
}
func (m Mask) String() string {
	return mapToString(m)
}
type MaskInverse map[string]FieldFilterContainer
func (m MaskInverse) Get(fieldName string) (FieldFilterContainer, bool) {
	f, ok := m[fieldName]
	return f, ok
}
func (m MaskInverse) Set(fieldName string, filter FieldFilterContainer) {
	m[fieldName] = filter
}