1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-18 00:20:57 +03:00

refactor: simplify push notification interface

- Remove RegisterPushNotificationHandlerFunc methods from all types
- Remove PushNotificationHandlerFunc type adapter
- Keep only RegisterPushNotificationHandler method for cleaner interface
- Remove unnecessary push notification constants (keep only Redis Cluster ones)
- Update all tests to use simplified interface with direct handler implementations

Benefits:
- Cleaner, simpler API with single registration method
- Reduced code complexity and maintenance burden
- Focus on essential Redis Cluster push notifications only
- Users implement PushNotificationHandler interface directly
- No functional changes, just interface simplification
This commit is contained in:
Nedyalko Dyakov
2025-06-27 00:17:47 +03:00
parent 4747610d01
commit 70231ae4e9
4 changed files with 89 additions and 142 deletions

View File

@ -833,15 +833,6 @@ func (c *Client) RegisterPushNotificationHandler(command string, handler PushNot
return nil
}
// RegisterPushNotificationHandlerFunc registers a function as a handler for a specific push notification command.
// Returns an error if a handler is already registered for this command.
func (c *Client) RegisterPushNotificationHandlerFunc(command string, handlerFunc func(ctx context.Context, notification []interface{}) bool) error {
if c.pushProcessor != nil {
return c.pushProcessor.RegisterHandlerFunc(command, handlerFunc)
}
return nil
}
// GetPushNotificationProcessor returns the push notification processor.
func (c *Client) GetPushNotificationProcessor() *PushNotificationProcessor {
return c.pushProcessor
@ -1014,15 +1005,6 @@ func (c *Conn) RegisterPushNotificationHandler(command string, handler PushNotif
return nil
}
// RegisterPushNotificationHandlerFunc registers a function as a handler for a specific push notification command.
// Returns an error if a handler is already registered for this command.
func (c *Conn) RegisterPushNotificationHandlerFunc(command string, handlerFunc func(ctx context.Context, notification []interface{}) bool) error {
if c.pushProcessor != nil {
return c.pushProcessor.RegisterHandlerFunc(command, handlerFunc)
}
return nil
}
// GetPushNotificationProcessor returns the push notification processor.
func (c *Conn) GetPushNotificationProcessor() *PushNotificationProcessor {
return c.pushProcessor