You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
374 B

4 years ago
  1. package models
  2. type Event struct {
  3. Name string `json:"name"`
  4. Payload map[string]string `json:"payload,omitempty"`
  5. }
  6. func (e *Event) AddPayload(key, value string) {
  7. if e.Payload == nil {
  8. e.Payload = make(map[string]string, 8)
  9. }
  10. e.Payload[key] = value
  11. }
  12. func (e *Event) HasPayload(key string) bool {
  13. return e.Payload != nil && e.Payload[key] != ""
  14. }