Пример #1
0
// FilterMail installs a featureBreaker mail filter in the context.
func FilterMail(c context.Context, defaultError error) (context.Context, FeatureBreaker) {
	state := newState(defaultError)
	return mail.AddFilters(c, func(ic context.Context, i mail.Interface) mail.Interface {
		return &mailState{state, i}
	}), state
}
Пример #2
0
// FilterMail installs a counter Mail filter in the context.
func FilterMail(c context.Context) (context.Context, *MailCounter) {
	state := &MailCounter{}
	return mail.AddFilters(c, func(ic context.Context, u mail.Interface) mail.Interface {
		return &mailCounter{state, u}
	}), state
}