strings

package
v2.292.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 2 Imported by: 0

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

View Source
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 Bytes added in v2.5.0

func Bytes(s string) []byte

Bytes is an alias for strings.Bytes.

func Concat added in v2.191.0

func Concat(ss ...string) string

Concat is an alias for strings.Concat.

func Contains added in v2.191.0

func Contains(s, substr string) bool

Contains is an alias for strings.Contains.

func Cut added in v2.8.0

func Cut(s, sep string) (string, string, bool)

Cut is an alias for strings.Cut.

func IsEmpty added in v2.8.0

func IsEmpty(s string) bool

IsEmpty is an alias for strings.IsEmpty.

func IsFullMethod added in v2.194.0

func IsFullMethod(name string) bool

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

func IsIgnorable(text string) bool

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 Join added in v2.5.0

func Join(sep string, ss ...string) string

Join is an alias for strings.Join.

func SplitServiceMethod added in v2.189.0

func SplitServiceMethod(name string) (string, string, bool)

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).

func ToLower added in v2.8.0

func ToLower(s string) string

ToLower is an alias for strings.ToLower.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL