feat: new event
This commit is contained in:
23
templates/events/publisher.go.tpl
Normal file
23
templates/events/publisher.go.tpl
Normal file
@@ -0,0 +1,23 @@
|
||||
package publishers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"{{.ModuleName}}/app/events"
|
||||
|
||||
"git.ipao.vip/rogeecn/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}}
|
||||
}
|
||||
Reference in New Issue
Block a user