Exemple #1
0
// FilterUser installs a featureBreaker user filter in the context.
func FilterUser(c context.Context, defaultError error) (context.Context, FeatureBreaker) {
	state := newState(defaultError)
	return user.AddFilters(c, func(ic context.Context, i user.Interface) user.Interface {
		return &userState{state, i}
	}), state
}
Exemple #2
0
// FilterUser installs a counter User filter in the context.
func FilterUser(c context.Context) (context.Context, *UserCounter) {
	state := &UserCounter{}
	return user.AddFilters(c, func(ic context.Context, u user.Interface) user.Interface {
		return &userCounter{state, u}
	}), state
}