redis

package
v1.7.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDefault

func CreateDefault(ctx context.Context, opts ...Options)

func Subscribe

func Subscribe(ctx context.Context, client Client, messageHandle func(message *Message), opts ...PubSubOptions) error

Types

type Client

type Client interface {
	redis.UniversalClient
}

func Default

func Default() Client

func NewClient

func NewClient(opts ...Options) Client

type Config

type Config struct {
	Host     string
	Password string
	Database int
}

func NewConfig

func NewConfig() *Config

func (*Config) Apply

func (options *Config) Apply(config *Config)

func (*Config) NewClient

func (options *Config) NewClient() *redis.Client

type Message

type Message struct {
	Channel string
	Payload string
}

type Options

type Options interface {
	Apply(config *Config)
}

func ParseConfig

func ParseConfig(v *viper.Viper) []Options

func WithAddress

func WithAddress(host string, port int) Options

func WithDatabase

func WithDatabase(database int) Options

func WithPassword

func WithPassword(password string) Options

type PubSubConfig

type PubSubConfig struct {
	Config
	Channel            []string
	CheckALiveInterval time.Duration
}

func (*PubSubConfig) Apply

func (p *PubSubConfig) Apply(config *PubSubConfig)

type PubSubOptions

type PubSubOptions interface {
	Apply(config *PubSubConfig)
}

func WithChannel

func WithChannel(channel string) PubSubOptions

func WithCheckALiveInterval

func WithCheckALiveInterval(channel time.Duration) PubSubOptions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL