Full Mattermost server source with integrated Community Enterprise features. Includes vendor directory for offline/air-gapped builds. Structure: - enterprise-impl/: Enterprise feature implementations - enterprise-community/: Init files that register implementations - enterprise/: Bridge imports (community_imports.go) - vendor/: All dependencies for offline builds Build (online): go build ./cmd/mattermost Build (offline/air-gapped): go build -mod=vendor ./cmd/mattermost 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
47 lines
1.1 KiB
Go
47 lines
1.1 KiB
Go
package grammar
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
// EndsWithMatcher matches strings which end with one of the suffixes in the feature flag
|
|
type EndsWithMatcher struct {
|
|
Matcher
|
|
suffixes []string
|
|
}
|
|
|
|
// Match returns true if the key provided ends with one of the suffixes in the feature flag.
|
|
func (m *EndsWithMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool {
|
|
matchingKey, err := m.matchingKey(key, attributes)
|
|
if err != nil {
|
|
m.logger.Warning(fmt.Sprintf("EndsWithMatcher: %s", err.Error()))
|
|
return false
|
|
}
|
|
|
|
asString, ok := matchingKey.(string)
|
|
if !ok {
|
|
m.logger.Error("EndsWithMatcher: Error type-asserting string")
|
|
return false
|
|
}
|
|
|
|
for _, suffix := range m.suffixes {
|
|
if strings.HasSuffix(asString, suffix) {
|
|
return true
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// NewEndsWithMatcher returns a new instance of EndsWithMatcher
|
|
func NewEndsWithMatcher(negate bool, suffixes []string, attributeName *string) *EndsWithMatcher {
|
|
return &EndsWithMatcher{
|
|
Matcher: Matcher{
|
|
negate: negate,
|
|
attributeName: attributeName,
|
|
},
|
|
suffixes: suffixes,
|
|
}
|
|
}
|