MCPcopy Create free account
hub / github.com/docker/secrets-engine / Filter

Function Filter

x/secrets/pattern.go:163–171  ·  view source on GitHub ↗

Filter returns a reduced [Pattern] that is subset equal to [filter]. Returns false if there's no overlap between [filter] and [other]. Examples: - Filter(MustParsePattern("bar/**"), MustParsePattern("**")) => returns "bar/**" - Filter(MustParsePattern("**"), MustParsePattern("**")) => returns "**" -

(filter, other Pattern)

Source from the content-addressed store, hash-verified

161// - Filter(MustParsePattern("bar/**"), MustParsePattern("bar")) => returns "bar"
162// - Filter(MustParsePattern("bar/**"), MustParsePattern("foo/**")) => returns false
163func Filter(filter, other Pattern) (Pattern, bool) {
164 if filter.Includes(other) {
165 return other, true
166 }
167 if other.Includes(filter) {
168 return filter, true
169 }
170 return nil, false
171}
172
173func replace1(original, other string) (string, error) {
174 components := split(original)

Callers 1

Test_FilterFunction · 0.85

Calls 1

IncludesMethod · 0.65

Tested by 1

Test_FilterFunction · 0.68