redis

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Address

func Address(address string) redisOpt

func ApplyProperties

func ApplyProperties(properties *Properties) redisOpt

func BufferSize added in v1.0.4

func BufferSize(size int) subscriptionOpt

func Channels added in v1.0.4

func Channels(channels ...string) subscriptionOpt

func ConnectionTimeout

func ConnectionTimeout(timeout time.Duration) redisOpt

func DB

func DB(db int) redisOpt

func NewClient added in v1.0.3

func NewClient(opts ...redisOpt) (*redis.Client, func(), error)

func NewSubscription added in v1.0.4

func NewSubscription(client *redis.Client, opts ...subscriptionOpt) func()

func OnMessage added in v1.0.4

func OnMessage(handler func(*Message)) subscriptionOpt

func Password

func Password(password string) redisOpt

func PublishTimeout added in v1.0.4

func PublishTimeout(timeout time.Duration) publisherOpt

func PublisherCodec added in v1.0.4

func PublisherCodec(codec MessageCodec) publisherOpt

func SubscribeTimeout added in v1.0.4

func SubscribeTimeout(timeout time.Duration) subscriptionOpt

func SubscriptionCodec added in v1.0.4

func SubscriptionCodec(codec MessageCodec, payloadStruct interface{}) subscriptionOpt

func TLS

func TLS(tls bool) redisOpt

func TargetChannel added in v1.0.4

func TargetChannel(channel string) publisherOpt

func Username

func Username(username string) redisOpt

Types

type JSONMessageCodec added in v1.0.4

type JSONMessageCodec struct {
}

func (*JSONMessageCodec) Marshall added in v1.0.4

func (codec *JSONMessageCodec) Marshall(val interface{}) ([]byte, error)

func (*JSONMessageCodec) Name added in v1.0.4

func (codec *JSONMessageCodec) Name() string

func (*JSONMessageCodec) Unmarshall added in v1.0.4

func (codec *JSONMessageCodec) Unmarshall(data []byte, target interface{}) error

type Message added in v1.0.4

type Message struct {
	Raw     *redis.Message
	Payload interface{}
}

type MessageCodec added in v1.0.4

type MessageCodec interface {
	Name() string
	Marshall(interface{}) ([]byte, error)
	Unmarshall([]byte, interface{}) error
}

type Properties

type Properties struct {
	DSN               string `json:"dsn" yaml:"dsn"`
	ConnectionTimeout int64  `json:"connectionTimeout" yaml:"connectionTimeout"`
}

type Publisher added in v1.0.4

type Publisher struct {
	// contains filtered or unexported fields
}

func NewPublisher added in v1.0.4

func NewPublisher(client *redis.Client, opts ...publisherOpt) (*Publisher, error)

func (*Publisher) Publish added in v1.0.4

func (publisher *Publisher) Publish(message interface{}) (int64, error)

Jump to

Keyboard shortcuts

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