producer

package
v0.0.0-...-c1f6a72 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2019 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*config)

An Option adjusts the config for a producer.

func WithMaxLen

func WithMaxLen(maxLen int64) Option

WithMaxLen sets the max length for a producer.

func WithMaxLenApprox

func WithMaxLenApprox(maxLenApprox int64) Option

WithMaxLenApprox sets the approximate max length for a producer.

type Producer

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

A Producer writes messages to a stream.

func New

func New(client *redis.Client, stream string, options ...Option) *Producer

New creates a new Producer.

func (*Producer) Write

func (p *Producer) Write(ctx context.Context, options ...WriteOption) (string, error)

Write writes a message to the stream. ID can be set to the empty string (or *) to auto-generate an ID.

type WriteOption

type WriteOption func(*writeConfig)

A WriteOption is an option to the write method.

func WithField

func WithField(field string, value interface{}) WriteOption

WithField sets a field-value pair in the values for a write.

func WithID

func WithID(id string) WriteOption

WithID sets the id of a write.

Jump to

Keyboard shortcuts

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