Documentation
¶
Index ¶
- func Close()
- func OnCreateFeed(callback func(CreatedFeedMessage)) error
- func PublishCreatedFeed(cxt context.Context, feed *models.Feed) error
- func SetEventStore(store EventStore)
- func SubscribeCreatedFeed(cxt context.Context) (<-chan CreatedFeedMessage, error)
- type CreatedFeedMessage
- type EventStore
- type Message
- type NatsEventStore
- func (nats *NatsEventStore) Close()
- func (nats *NatsEventStore) OnCreateFeed(callback func(CreatedFeedMessage)) (err error)
- func (nats *NatsEventStore) PublishCreatedFeed(cxt context.Context, feed *models.Feed) error
- func (nats *NatsEventStore) SubscribeCreatedFeed(cxt context.Context) (<-chan CreatedFeedMessage, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OnCreateFeed ¶
func OnCreateFeed(callback func(CreatedFeedMessage)) error
func SetEventStore ¶
func SetEventStore(store EventStore)
func SubscribeCreatedFeed ¶
func SubscribeCreatedFeed(cxt context.Context) (<-chan CreatedFeedMessage, error)
Types ¶
type CreatedFeedMessage ¶
type CreatedFeedMessage struct { Id string `json:"id"` Title string `json:"title"` Description string `json:"description"` CreatedAt time.Time `json:"created_at"` }
func (*CreatedFeedMessage) Type ¶
func (createdFeedMessage *CreatedFeedMessage) Type() string
type EventStore ¶
type NatsEventStore ¶
type NatsEventStore struct { Connection *natsio.Conn FeedCreatedSub *natsio.Subscription FeedCreatedChan chan CreatedFeedMessage }
func NewNats ¶
func NewNats(url string) (*NatsEventStore, error)
func (*NatsEventStore) Close ¶
func (nats *NatsEventStore) Close()
func (*NatsEventStore) OnCreateFeed ¶
func (nats *NatsEventStore) OnCreateFeed(callback func(CreatedFeedMessage)) (err error)
func (*NatsEventStore) PublishCreatedFeed ¶
func (*NatsEventStore) SubscribeCreatedFeed ¶
func (nats *NatsEventStore) SubscribeCreatedFeed(cxt context.Context) (<-chan CreatedFeedMessage, error)
Click to show internal directories.
Click to hide internal directories.