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>
70 lines
1.1 KiB
Go
70 lines
1.1 KiB
Go
package common
|
|
|
|
// StringRef returns ref
|
|
func StringRef(str string) *string {
|
|
return &str
|
|
}
|
|
|
|
// StringFromRef returns original value if not empty. Default otherwise.
|
|
func StringFromRef(str *string) string {
|
|
if str == nil {
|
|
return ""
|
|
}
|
|
return *str
|
|
}
|
|
|
|
// IntRef returns ref
|
|
func IntRef(number int) *int {
|
|
return &number
|
|
}
|
|
|
|
// IntFromRef returns 0 if nil, dereferenced value otherwhise.
|
|
func IntFromRef(ref *int) int {
|
|
if ref == nil {
|
|
return 0
|
|
}
|
|
return *ref
|
|
}
|
|
|
|
// Int64Ref returns ref
|
|
func Int64Ref(number int64) *int64 {
|
|
return &number
|
|
}
|
|
|
|
// Int64FromRef returns value
|
|
func Int64FromRef(number *int64) int64 {
|
|
if number == nil {
|
|
return 0
|
|
}
|
|
return *number
|
|
}
|
|
|
|
// Float64Ref returns ref
|
|
func Float64Ref(number float64) *float64 {
|
|
return &number
|
|
}
|
|
|
|
// IntRefOrNil returns ref
|
|
func IntRefOrNil(number int) *int {
|
|
if number == 0 {
|
|
return nil
|
|
}
|
|
return IntRef(number)
|
|
}
|
|
|
|
// Int64RefOrNil returns ref
|
|
func Int64RefOrNil(number int64) *int64 {
|
|
if number == 0 {
|
|
return nil
|
|
}
|
|
return Int64Ref(number)
|
|
}
|
|
|
|
// StringRefOrNil returns ref
|
|
func StringRefOrNil(str string) *string {
|
|
if str == "" {
|
|
return nil
|
|
}
|
|
return StringRef(str)
|
|
}
|