dir2opds/opds/author_builder.go

32 lines
828 B
Go
Raw Normal View History

package opds
2017-05-11 23:06:21 +00:00
import (
"github.com/lann/builder"
"golang.org/x/tools/blog/atom"
)
type authorBuilder builder.Builder
func (a authorBuilder) Name(name string) authorBuilder {
return builder.Set(a, "Name", name).(authorBuilder)
}
func (a authorBuilder) URI(uri string) authorBuilder {
return builder.Set(a, "URI", uri).(authorBuilder)
}
func (a authorBuilder) Email(email string) authorBuilder {
return builder.Set(a, "Email", email).(authorBuilder)
}
2018-03-03 20:12:41 +00:00
func (a authorBuilder) InnerXML(inner string) authorBuilder {
return builder.Set(a, "InnerXML", inner).(authorBuilder)
2017-05-11 23:06:21 +00:00
}
func (a authorBuilder) Build() atom.Person {
return builder.GetStruct(a).(atom.Person)
}
2018-03-03 20:12:41 +00:00
// AuthorBuilder is a fluent immutable builder to build OPDS Authors
2017-05-11 23:06:21 +00:00
var AuthorBuilder = builder.Register(authorBuilder{}, atom.Person{}).(authorBuilder)