(allowedPaths []string, requestedPaths *fieldmaskpb.FieldMask, addPaths, removePaths []string)
| 33 | ) |
| 34 | |
| 35 | func cleanFieldMaskPaths(allowedPaths []string, requestedPaths *fieldmaskpb.FieldMask, addPaths, removePaths []string) *fieldmaskpb.FieldMask { |
| 36 | selected := make(map[string]struct{}) |
| 37 | for _, path := range addPaths { |
| 38 | selected[path] = struct{}{} |
| 39 | } |
| 40 | for _, path := range requestedPaths.GetPaths() { |
| 41 | selected[path] = struct{}{} |
| 42 | } |
| 43 | for _, path := range removePaths { |
| 44 | delete(selected, path) |
| 45 | } |
| 46 | out := make([]string, 0, len(selected)) |
| 47 | for _, path := range allowedPaths { |
| 48 | if _, ok := selected[path]; ok { |
| 49 | out = append(out, path) |
| 50 | } |
| 51 | } |
| 52 | return ttnpb.FieldMask(out...) |
| 53 | } |
| 54 | |
| 55 | func cleanContactInfo(info []*ttnpb.ContactInfo) { |
| 56 | for _, info := range info { |
no test coverage detected