trying_out_go/pkg/date/event.go

24 lines
317 B
Go
Raw Permalink Normal View History

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
}