feat: mv internal/pkg to root [skip ci]

This commit is contained in:
lab
2021-12-31 03:37:11 +08:00
parent ab7b33e589
commit 0989b9ebdc
14 changed files with 0 additions and 0 deletions

27
pkg/pubsub/pubsub.go Normal file
View File

@@ -0,0 +1,27 @@
package pubsub
import "context"
type Subject string
func (subject Subject) String() string {
return string(subject)
}
type Message interface{}
type Publishing struct{}
type PublishOption func(*Publishing)
type Publisher interface {
Publish(context.Context, Subject, Message, ...PublishOption) error
}
type MessageHandler interface {
HandleMessage(context.Context, *Message) error
}
type Subscriber interface {
Subscribe(context.Context, Subject, MessageHandler) error
}