utils

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: MulanPSL-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NL = "\n"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageHandler

type MessageHandler func(msg []byte) error

MessageHandler represents Message handler for Subscriber.

type PubSub

type PubSub interface {
	Publisher
	Subscriber
}

PubSub represents aggregation interface for publisher and subscriber.

type Publisher

type Publisher interface {
	// Publishes message to the stream.
	Publish(topic, subtopic string, msg []byte) error
}

Publisher specifies message publishing API.

type Subscriber

type Subscriber interface {
	// Subscribe subscribes to the message stream and consumes messages.
	Subscribe(topic string, handler MessageHandler) error

	// Unsubscribe unsubscribes from the message stream and
	// stops consuming messages.
	Unsubscribe(topic string) error
}

Subscriber specifies message subscription API.

Directories

Path Synopsis
snowflake is a distributed unique ID generator inspired by Twitter's snowflake.
snowflake is a distributed unique ID generator inspired by Twitter's snowflake.
gcache-adapter
Redis Stream 是 Redis 5.0 版本新增加的数据结构。
Redis Stream 是 Redis 5.0 版本新增加的数据结构。
pb
Package guuid generates and inspects UUIDs.
Package guuid generates and inspects UUIDs.

Jump to

Keyboard shortcuts

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