2021-05-13 08:15:14 +02:00
|
|
|
package msend
|
|
|
|
|
|
|
|
type Memory struct {
|
|
|
|
Messages []*Message
|
2021-06-24 06:56:00 +02:00
|
|
|
Err error
|
2021-05-13 08:15:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewMemory() *Memory {
|
|
|
|
return &Memory{
|
|
|
|
Messages: []*Message{},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mem *Memory) Send(msg *Message) error {
|
2021-06-24 06:56:00 +02:00
|
|
|
if mem.Err != nil {
|
|
|
|
return mem.Err
|
|
|
|
}
|
|
|
|
|
2021-05-13 08:15:14 +02:00
|
|
|
mem.Messages = append(mem.Messages, msg)
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|