pair_event.go 408 B

1234567891011121314151617181920212223242526
  1. package eventBase
  2. type PairEvent[K any, V any] struct {
  3. EmptyEvent
  4. key K
  5. value V
  6. }
  7. func NewPairEvent[K any, V any](id int64, name string, key K, value V) PairEvent[K, V] {
  8. return PairEvent[K, V]{
  9. EmptyEvent: EmptyEvent{
  10. id: id,
  11. name: name,
  12. },
  13. key: key,
  14. value: value,
  15. }
  16. }
  17. func (p *PairEvent[K, V]) Key() K {
  18. return p.key
  19. }
  20. func (p *PairEvent[K, V]) Value() V {
  21. return p.value
  22. }