mirror of
https://github.com/NohamR/papeer.git
synced 2026-05-25 20:00:47 +00:00
28 lines
405 B
Go
28 lines
405 B
Go
package book
|
|
|
|
type book struct {
|
|
name string
|
|
author string
|
|
chapters []chapter
|
|
}
|
|
|
|
func New(name, author string) book {
|
|
return book{name, author, []chapter{}}
|
|
}
|
|
|
|
func (b *book) AddChapter(c chapter) {
|
|
b.chapters = append(b.chapters, c)
|
|
}
|
|
|
|
func (b book) Name() string {
|
|
return b.name
|
|
}
|
|
|
|
func (b book) Author() string {
|
|
return b.name
|
|
}
|
|
|
|
func (b *book) Chapters() []chapter {
|
|
return b.chapters
|
|
}
|