Documentation ¶
Index ¶
- Variables
- func WrapCmdErr(cmd redis.Cmder) error
- type Client
- func (c *Client) GetAddr() string
- func (c *Client) HMYield(ctx context.Context, key string, fields ...string) (<-chan HPair, <-chan error)
- func (c *Client) HYield(ctx context.Context, key string) (<-chan HPair, <-chan error)
- func (c *Client) MarshalLogObject(encoder zapcore.ObjectEncoder) error
- func (c *Client) XReadUntilResult(ctx context.Context, a *redis.XReadArgs) ([]redis.XStream, error)
- type Config
- type HPair
- type IntCmd
- type Options
- type Pipeliner
- type Streams
- type XAddArgs
- type XMessage
- type XReadArgs
Constants ¶
This section is empty.
Variables ¶
var NewScript = redis.NewScript
Functions ¶
func WrapCmdErr ¶
func WrapCmdErr(cmd redis.Cmder) error
WrapCmdErr adds the command itself and the stack of the current goroutine to the command's error if any.
Types ¶
type Client ¶
type Client struct { *redis.Client Options *Options // contains filtered or unexported fields }
Client is a wrapper around redis.Client with streaming and logging capabilities.
func NewClientFromConfig ¶
NewClientFromConfig returns a new Client from Config.
func (*Client) GetAddr ¶
GetAddr returns a URI-like Redis connection string.
It has the following syntax:
redis[+tls]://user@host[:port]/database
func (*Client) HMYield ¶
func (c *Client) HMYield(ctx context.Context, key string, fields ...string) (<-chan HPair, <-chan error)
HMYield yields HPair field-value pairs for the specified fields in the hash stored at key.
func (*Client) HYield ¶
HYield yields HPair field-value pairs for all fields in the hash stored at key.
func (*Client) MarshalLogObject ¶ added in v0.4.0
func (c *Client) MarshalLogObject(encoder zapcore.ObjectEncoder) error
MarshalLogObject implements zapcore.ObjectMarshaler, adding the redis address Client.GetAddr to each log message.
func (*Client) XReadUntilResult ¶
XReadUntilResult (repeatedly) calls XREAD with the specified arguments until a result is returned. Each call blocks at most for the duration specified in Options.BlockTimeout until data is available before it times out and the next call is made. This also means that an already set block timeout is overridden.
type Config ¶
type Config struct { Host string `yaml:"host" env:"HOST"` Port int `yaml:"port" env:"PORT"` Username string `yaml:"username" env:"USERNAME"` Password string `yaml:"password" env:"PASSWORD,unset"` Database int `yaml:"database" env:"DATABASE" default:"0"` TlsOptions config.TLS `yaml:",inline"` Options Options `yaml:"options" envPrefix:"OPTIONS_"` }
Config defines Config client configuration.
type Options ¶
type Options struct { BlockTimeout time.Duration `yaml:"block_timeout" env:"BLOCK_TIMEOUT" default:"1s"` HMGetCount int `yaml:"hmget_count" env:"HMGET_COUNT" default:"4096"` HScanCount int `yaml:"hscan_count" env:"HSCAN_COUNT" default:"4096"` MaxHMGetConnections int `yaml:"max_hmget_connections" env:"MAX_HMGET_CONNECTIONS" default:"8"` Timeout time.Duration `yaml:"timeout" env:"TIMEOUT" default:"30s"` XReadCount int `yaml:"xread_count" env:"XREAD_COUNT" default:"4096"` }
Options define user configurable Redis options.