mirror of
https://github.com/redis/go-redis.git
synced 2025-07-16 13:21:51 +03:00
40 lines
1.5 KiB
Go
40 lines
1.5 KiB
Go
package push
|
|
|
|
import (
|
|
"github.com/redis/go-redis/v9/internal/pool"
|
|
)
|
|
|
|
// NotificationHandlerContext provides context information about where a push notification was received.
|
|
// This struct allows handlers to make informed decisions based on the source of the notification
|
|
// with strongly typed access to different client types using concrete types.
|
|
type NotificationHandlerContext struct {
|
|
// Client is the Redis client instance that received the notification.
|
|
// It is interface to both allow for future expansion and to avoid
|
|
// circular dependencies. The developer is responsible for type assertion.
|
|
// It can be one of the following types:
|
|
// - *redis.baseClient
|
|
Client interface{}
|
|
|
|
// ConnPool is the connection pool from which the connection was obtained.
|
|
// It is interface to both allow for future expansion and to avoid
|
|
// circular dependencies. The developer is responsible for type assertion.
|
|
// It can be one of the following types:
|
|
// - *pool.ConnPool
|
|
// - *pool.SingleConnPool
|
|
// - *pool.StickyConnPool
|
|
ConnPool pool.Pooler
|
|
|
|
// PubSub is the PubSub instance that received the notification.
|
|
// It is interface to both allow for future expansion and to avoid
|
|
// circular dependencies. The developer is responsible for type assertion.
|
|
// It can be one of the following types:
|
|
// - *redis.PubSub
|
|
PubSub interface{}
|
|
|
|
// Conn is the specific connection on which the notification was received.
|
|
Conn *pool.Conn
|
|
|
|
// IsBlocking indicates if the notification was received on a blocking connection.
|
|
IsBlocking bool
|
|
}
|