Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add PubSub to rueidiscompat #592

Merged
merged 1 commit into from
Jul 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions rueidiscompat/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,10 @@ type ProbabilisticCmdable interface {
TDigestReset(ctx context.Context, key string) *StatusCmd
TDigestRevRank(ctx context.Context, key string, values ...float64) *IntSliceCmd
TDigestTrimmedMean(ctx context.Context, key string, lowCutQuantile, highCutQuantile float64) *FloatCmd

Subscribe(ctx context.Context, channels ...string) PubSub
PSubscribe(ctx context.Context, patterns ...string) PubSub
SSubscribe(ctx context.Context, channels ...string) PubSub
}

// Align with go-redis
Expand Down Expand Up @@ -4596,6 +4600,24 @@ func (c *Compat) JSONType(ctx context.Context, key, path string) *JSONSliceCmd {
return newJSONSliceCmd(c.client.Do(ctx, cmd))
}

func (c *Compat) Subscribe(ctx context.Context, channels ...string) PubSub {
p := newPubSub(c.client)
_ = p.Subscribe(ctx, channels...)
return p
}

func (c *Compat) SSubscribe(ctx context.Context, channels ...string) PubSub {
p := newPubSub(c.client)
_ = p.SSubscribe(ctx, channels...)
return p
}

func (c *Compat) PSubscribe(ctx context.Context, patterns ...string) PubSub {
p := newPubSub(c.client)
_ = p.PSubscribe(ctx, patterns...)
return p
}

func (c CacheCompat) BitCount(ctx context.Context, key string, bitCount *BitCount) *IntCmd {
var resp rueidis.RedisResult
if bitCount == nil {
Expand Down
Loading
Loading