Skip to content

Commit 1206de6

Browse files
committed
Clean up comments
1 parent 083ce27 commit 1206de6

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

Diff for: fieldpath/set.go

+22-20
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ func MustPrefixPattern(parts ...interface{}) *SetPattern {
147147
return result
148148
}
149149

150-
// PrefixPattern creates a SetPattern that matches all field paths prefixed by the given list of path parts.
151-
// The parts may be PathPatterns, PathElements, strings (for field names) or ints (for array indices).
152-
// `MatchAnyPathElement()` may be used to "wildcard" match any PathElement at that position in the field path.
150+
// PrefixPattern creates a SetPattern that matches all field paths prefixed by the given list of pattern path parts.
151+
// The pattern parts may be PathPatterns, PathElements, strings (for field names) or ints (for array indices).
152+
// `MatchAnyPathElement()` may be used as a pattern path part to wildcard match a field path part.
153153
func PrefixPattern(parts ...interface{}) (*SetPattern, error) {
154154
current := MatchAnySet() // match all field patch suffixes
155155
for i := len(parts) - 1; i >= 0; i-- {
@@ -190,24 +190,25 @@ func MatchAnySet() *SetPattern {
190190
// SetPattern defines a pattern that matches fields in a Set.
191191
// SetPattern is structured much like a Set but with wildcard support.
192192
type SetPattern struct {
193-
// Wildcard indicates that all members and children are matched.
194-
// If set, the Members and Children fields are ignored.
193+
// Wildcard indicates that all members and children are included in the match.
194+
// If set, the Members field is ignored.
195195
Wildcard bool
196-
// Members provides patterns to match the Members of a Set.
197-
// If any PatchPattern is a wildcard, then all members of a Set are matched.
198-
// Otherwise, if any PathPattern is Equal to a member of a Set, that member is matched.
196+
// Members provides patterns to match the members of a Set.
199197
Members []*MemberSetPattern
200198
}
201199

202-
// MemberSetPattern defines a pattern that matches the Members of a Set.
203-
// MemberSetPattern is structured much like the elements of a SetNodeMap, but with wildcard support.
200+
// MemberSetPattern defines a pattern that matches the members of a Set.
201+
// MemberSetPattern is structured much like the elements of a SetNodeMap, but
202+
// with wildcard support.
204203
type MemberSetPattern struct {
205-
// Path provides a pattern to match Members of a Set.
206-
// If Path is a wildcard, all Members of a Set are matched.
207-
// Otherwise, the Member of a Set with a path that is Equal to this Path is matched.
204+
// Path provides a pattern to match members of a Set.
205+
// If Path is a wildcard, all members of a Set are included in the match.
206+
// Otherwise, if any Path is Equal to a member of a Set, that member is
207+
// included in the match and the children of that member are matched
208+
// against the Child pattern.
208209
Path PathPattern
209210

210-
// Child provides a pattern to use for Member of a Set that were matched by this MemberSetPattern's Path.
211+
// Child provides a pattern to use for the children of matched members of a Set.
211212
Child *SetPattern
212213
}
213214

@@ -217,11 +218,12 @@ type PathPattern struct {
217218
// If set, PathElement is ignored.
218219
Wildcard bool
219220

220-
// PathElement matches another PathElement if it is Equal to this PathElement.
221+
// PathElement indicates that a PathElement is matched if it is Equal
222+
// to this PathElement.
221223
PathElement
222224
}
223225

224-
// FilterByPattern returns a Set with only fields that match the pattern.
226+
// FilterByPattern returns a Set with only the field paths that match the pattern.
225227
func (s *Set) FilterByPattern(pattern *SetPattern) *Set {
226228
if pattern.Wildcard {
227229
return s
@@ -582,7 +584,7 @@ func (s *SetNodeMap) EnsureNamedFieldsAreMembers(sc *schema.Schema, tr schema.Ty
582584
}
583585
}
584586

585-
// FilterByPattern returns a set that is filtered by the pattern.
587+
// FilterByPattern returns a SetNodeMap with only the field paths that match the pattern.
586588
func (s *SetNodeMap) FilterByPattern(pattern *SetPattern) *SetNodeMap {
587589
if pattern.Wildcard {
588590
return s
@@ -637,12 +639,12 @@ func (s *SetNodeMap) Leaves() *SetNodeMap {
637639
return out
638640
}
639641

640-
// Filter defines an interface for filtering Set.
641-
// NewExcludeFilter can be used to create a filter that removes fields at the
642+
// Filter defines an interface for filtering a set.
643+
// NewExcludeFilter can be used to create a filter that removes
642644
// excluded field paths.
643645
// NewPatternFilter can be used to create a filter that removes all fields except
644646
// the fields that match a field path pattern. PrefixPattern and MustPrefixPattern
645-
// can help create field path patterns.
647+
// can be used to define field path patterns.
646648
type Filter interface {
647649
// Filter returns a filtered copy of the set.
648650
Filter(*Set) *Set

0 commit comments

Comments
 (0)