Files
atomctl/templates/events/publisher.go.tpl
2025-01-22 14:50:54 +08:00

24 lines
384 B
Smarty

package publishers
import (
"encoding/json"
"{{.ModuleName}}/app/events"
"{{.ModuleName}}/pkg/atom/contracts"
)
var _ contracts.EventPublisher = (*{{.Name}}Event)(nil)
type {{.Name}}Event struct {
ID int64 `json:"id"`
}
func (e *{{.Name}}Event) Marshal() ([]byte, error) {
return json.Marshal(e)
}
func (e *{{.Name}}Event) Topic() string {
return events.Topic{{.Name}}
}