dir2opds/text_builder.go
2018-03-03 15:12:41 -05:00

24 lines
568 B
Go

package main
import (
"github.com/lann/builder"
"golang.org/x/tools/blog/atom"
)
type textBuilder builder.Builder
func (t textBuilder) Type(textType string) textBuilder {
return builder.Set(t, "Type", textType).(textBuilder)
}
func (t textBuilder) Body(body string) textBuilder {
return builder.Set(t, "Body", body).(textBuilder)
}
func (t textBuilder) Build() atom.Text {
return builder.GetStruct(t).(atom.Text)
}
// TextBuilder is a fluent immutable builder to build OPDS texts
var TextBuilder = builder.Register(textBuilder{}, atom.Text{}).(textBuilder)