gredis_subscription.go 745 B

123456789101112131415161718192021
  1. // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
  2. //
  3. // This Source Code Form is subject to the terms of the MIT License.
  4. // If a copy of the MIT was not distributed with this file,
  5. // You can obtain one at https://github.com/gogf/gf.
  6. package gredis
  7. import "fmt"
  8. // Subscription received after a successful subscription to channel.
  9. type Subscription struct {
  10. Kind string // Can be "subscribe", "unsubscribe", "psubscribe" or "punsubscribe".
  11. Channel string // Channel name we have subscribed to.
  12. Count int // Number of channels we are currently subscribed to.
  13. }
  14. // String converts current object to a readable string.
  15. func (m *Subscription) String() string {
  16. return fmt.Sprintf("%s: %s", m.Kind, m.Channel)
  17. }