events

package
v0.0.0-...-6b5a9da Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const UserVotedPostEventDataType = "user_voted_post"
View Source
const UserVotedTopic = "user-voted"

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type string    `json:"type"`
	Data EventData `json:"data"`
}

func NewEvent

func NewEvent(event_type string, data interface{}) Event

func (*Event) UnmarshalJSON

func (e *Event) UnmarshalJSON(data []byte) error

type EventData

type EventData interface{}

func UnmarshalUserVotedPostEventData

func UnmarshalUserVotedPostEventData(data json.RawMessage) (EventData, error)

type EventDataParser

type EventDataParser func(data json.RawMessage) (EventData, error)

type Events

type Events struct {
	DaprClient          dapr.Client
	PubSubComponentName string
}

func New

func New(dapr_client dapr.Client, pub_sub_component_name string) *Events

func (*Events) Publish

func (e *Events) Publish(ctx context.Context, topic string, event Event) error

func (*Events) PublishUserVotedPostEvent

func (e *Events) PublishUserVotedPostEvent(ctx context.Context, data *UserVotedPostEventData) error

type UserVotedPostEventData

type UserVotedPostEventData struct {
	PostVoteID int64           `json:"post_vote_id"`
	PostID     int64           `json:"post_id"`
	UserID     int64           `json:"user_id"`
	VoteType   state.VoteValue `json:"vote_type"`
	Timestamp  time.Time       `json:"timestamp"`
}

func NewUserVotedPostEventData

func NewUserVotedPostEventData(post_vote_id, post_id, user_id int64, vote_type state.VoteValue, timestamp time.Time) UserVotedPostEventData

Jump to

Keyboard shortcuts

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