gf/database/gredis/gredis_subscription.go

22 lines
745 B
Go
Raw Normal View History

2021-09-26 23:22:32 +08:00
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package gredis
import "fmt"
// Subscription received after a successful subscription to channel.
type Subscription struct {
Kind string // Can be "subscribe", "unsubscribe", "psubscribe" or "punsubscribe".
Channel string // Channel name we have subscribed to.
Count int // Number of channels we are currently subscribed to.
}
// String converts current object to a readable string.
func (m *Subscription) String() string {
return fmt.Sprintf("%s: %s", m.Kind, m.Channel)
}