1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
package grpccorrelation
// The configuration for InjectCorrelationID.
type clientInterceptConfig struct {
clientName string
}
// ClientCorrelationInterceptorOption configures client correlation interceptors.
type ClientCorrelationInterceptorOption func(*clientInterceptConfig)
func applyClientCorrelationInterceptorOptions(opts []ClientCorrelationInterceptorOption) clientInterceptConfig {
config := clientInterceptConfig{}
for _, v := range opts {
v(&config)
}
return config
}
// WithClientName will configure the client name metadata on the
// GRPC client interceptors.
func WithClientName(clientName string) ClientCorrelationInterceptorOption {
return func(config *clientInterceptConfig) {
config.clientName = clientName
}
}
|