Files

30 lines
539 B
Go

package interfaces
type Notifier interface {
Format(msg string) string
}
type EmailNotifier struct {
Address string
}
func (e EmailNotifier) Format(msg string) string {
panic("TODO: zwróć '[email] ' + msg")
}
type SmsNotifier struct {
Phone string
}
func (s SmsNotifier) Format(msg string) string {
panic("TODO: zwróć '[sms] ' + msg")
}
type AlertService struct {
Notifiers []Notifier
}
func (a *AlertService) Broadcast(msg string) []string {
panic("TODO: wywołaj Format(msg) dla każdego notifiera i zwróć wyniki")
}