Documentation ¶
Index ¶
- Constants
- func Connect(config ClientOptions) (err error)
- func Get[T any](key Key) (res T, err error)
- func GetOrSet[T any](key Key, ttl time.Duration, fn func() (T, error)) (res T, err error)
- func IsNil(err error) bool
- func Publisher[T any](channel string, config PublisherConfig) func(T) error
- func Set(key Key, ttl time.Duration, value interface{}) (err error)
- func SetNX(key Key, ttl time.Duration, value interface{}) (err error)
- func Subscribe[T any](channel string, receiver ReceiverFunc[T], onError ErrorFunc) func()
- type ClientOptions
- type EnvClientConfig
- type ErrorFunc
- type Key
- type Message
- type PublisherConfig
- type ReceiverFunc
- type StreamConsumer
- type StreamConsumerConfig
- type StreamPublisher
- type StreamPublisherConfig
Constants ¶
View Source
const DefaultTimeout = 2 * time.Second
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
func Connect(config ClientOptions) (err error)
Types ¶
type ClientOptions ¶
type ClientOptions struct { Hostname string `validation:"required,hostname"` Port int `validation:"required,numeric"` Password string `validation:"required"` Timeout time.Duration `validation:"required"` TLS *tls.Config }
func ClientOptionsFromEnvConfig ¶
func ClientOptionsFromEnvConfig(cfg EnvClientConfig) ClientOptions
func (ClientOptions) FormatHost ¶
func (o ClientOptions) FormatHost() string
func (ClientOptions) FormatUri ¶
func (o ClientOptions) FormatUri() string
type EnvClientConfig ¶
type PublisherConfig ¶
type ReceiverFunc ¶
type StreamConsumer ¶
type StreamConsumer[T any] struct { Emitter *eventlib.Emitter[*Message[T]] // contains filtered or unexported fields }
func NewStreamConsumer ¶
func NewStreamConsumer[T any](cfg StreamConsumerConfig) (res *StreamConsumer[T], err error)
func (*StreamConsumer[T]) Cancel ¶
func (s *StreamConsumer[T]) Cancel()
func (*StreamConsumer[T]) Consume ¶
func (s *StreamConsumer[T]) Consume() error
type StreamConsumerConfig ¶
type StreamPublisher ¶
type StreamPublisher[T any] struct { // contains filtered or unexported fields }
func NewStreamPublisher ¶
func NewStreamPublisher[T any](cfg StreamPublisherConfig) (res *StreamPublisher[T], err error)
func (*StreamPublisher[T]) Publish ¶
func (s *StreamPublisher[T]) Publish(payload T) (err error)
Click to show internal directories.
Click to hide internal directories.