24 lines
317 B
Go
24 lines
317 B
Go
|
package calendar
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
"unicode/utf8"
|
||
|
)
|
||
|
|
||
|
type Event struct {
|
||
|
title string
|
||
|
Date
|
||
|
}
|
||
|
|
||
|
func (e *Event) Title() string {
|
||
|
return e.title
|
||
|
}
|
||
|
|
||
|
func (e *Event) SetTitle(title string) error {
|
||
|
if utf8.RuneCountInString(title) > 32 {
|
||
|
return errors.New("invalid title length")
|
||
|
}
|
||
|
e.title = title
|
||
|
return nil
|
||
|
}
|