dir2opds/text_builder.go

24 lines
568 B
Go
Raw Normal View History

2017-05-11 23:06:21 +00:00
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)
}
2018-03-03 20:12:41 +00:00
// TextBuilder is a fluent immutable builder to build OPDS texts
2017-05-11 23:06:21 +00:00
var TextBuilder = builder.Register(textBuilder{}, atom.Text{}).(textBuilder)