Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Ctx ¶
type Ctx struct {
Request Request
Response *Response
Extras map[string]interface{}
// contains filtered or unexported fields
}
func NewCtx ¶
func NewCtx(msg *topicspb.ServerMessage) *Ctx
func (*Ctx) ToClientMessage ¶
func (c *Ctx) ToClientMessage() *topicspb.ClientMessage
type PublishOption ¶
type PublishOption func(*v1.TopicPublishRequest)
type SubscribableTopic ¶
type SubscribableTopic interface {
// Allow requests the given permissions to the topic.
Allow(permission TopicPermission, permissions ...TopicPermission) *TopicClient
// Subscribe will register and start a subscription handler that will be called for all events from this topic.
// Valid function signatures for handler are:
//
// func()
// func() error
// func(*topics.Ctx)
// func(*topics.Ctx) error
// Handler[topics.Ctx]
Subscribe(handler interface{})
}
func NewTopic ¶
func NewTopic(name string) SubscribableTopic
NewTopic creates a new Topic with the give name.
type TopicClient ¶
type TopicClient struct {
// contains filtered or unexported fields
}
func NewTopicClient ¶
func NewTopicClient(name string) (*TopicClient, error)
func (*TopicClient) Name ¶
func (s *TopicClient) Name() string
func (*TopicClient) Publish ¶
func (s *TopicClient) Publish(ctx context.Context, message map[string]interface{}, opts ...PublishOption) error
type TopicClientIface ¶
type TopicClientIface interface {
// Name returns the Topic name.
Name() string
// Publish will publish the provided events on the topic.
Publish(ctx context.Context, message map[string]interface{}, options ...PublishOption) error
}
TopicClientIface for pub/sub async messaging.
type TopicPermission ¶
type TopicPermission string
TopicPermission defines the available permissions on a topic
const ( // TopicPublish is required to call Publish on a topic. TopicPublish TopicPermission = "publish" )
Click to show internal directories.
Click to hide internal directories.