Documentation
¶
Overview ¶
Package strings provides string helpers used by transport packages in go-service.
This package mostly re-exports helpers from `github.com/alexfalkowski/go-service/v2/strings` and adds a few transport-specific helpers such as ignore checks for common endpoints and gRPC full method parsing.
Index ¶
- Constants
- func Bytes(s string) []byte
- func Concat(ss ...string) string
- func Contains(s, substr string) bool
- func Cut(s, sep string) (string, string, bool)
- func IsEmpty(s string) bool
- func IsFullMethod(name string) bool
- func IsIgnorable(text string) bool
- func Join(sep string, ss ...string) string
- func SplitServiceMethod(name string) (string, string, bool)
- func ToLower(s string) string
Constants ¶
const ( // Empty is an alias for strings.Empty. Empty = strings.Empty // Space is an alias for strings.Space. Space = strings.Space )
Variables ¶
This section is empty.
Functions ¶
func IsFullMethod ¶ added in v2.194.0
IsFullMethod reports whether name is of the form `/package.service/method`.
This is the canonical shape of gRPC full method names as they appear in interceptors (for example "/helloworld.Greeter/SayHello").
func IsIgnorable ¶ added in v2.192.0
IsIgnorable reports whether text should be treated as ignorable by transport middleware.
This helper is used across HTTP and gRPC transports to decide whether certain endpoints/methods should bypass middleware such as authentication, rate limiting, or logging.
Matching behavior: IsIgnorable returns true when text contains any of the predefined ignorable substrings (for example "healthz" or "metrics"). This is intentionally a substring match (not an exact match), so callers should avoid passing overly broad inputs that could accidentally match unrelated paths/method names.
func SplitServiceMethod ¶ added in v2.189.0
SplitServiceMethod splits a gRPC full method name into service and method components.
If name is not a valid gRPC full method (see IsFullMethod), it returns ("", "", false). Otherwise it returns ("package.service", "method", true).
Types ¶
This section is empty.