Documentation ¶
Index ¶
- Variables
- type Content
- type Resolver
- type Service
- func (s *Service) RandomVerse(ctx context.Context, opt ...ref.RandomReferenceOption) (*ref.Resolved, *Verse, error)
- func (s *Service) RandomVerseHTML(ctx context.Context, opt ...ref.RandomReferenceOption) (*ref.Resolved, template.HTML, error)
- func (s *Service) RandomVerseText(ctx context.Context, opt ...ref.RandomReferenceOption) (*ref.Resolved, string, error)
- func (s *Service) Verse(ctx context.Context, vr string) (*Verse, error)
- func (s *Service) VerseHTML(ctx context.Context, vr string) (template.HTML, error)
- func (s *Service) VerseText(ctx context.Context, vr string) (string, error)
- func (s *Service) VersionInformation(ctx context.Context) (*Version, error)
- type ServiceOption
- type Verse
- type Version
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrMultiVerse = errors.New("multiple verses not supported")
)
Functions ¶
This section is empty.
Types ¶
type Content ¶ added in v0.4.0
type Content struct { Text string `yaml:"text,omitempty" json:"text,omitempty"` HTML template.HTML `yaml:"html,omitempty" json:"html,omitempty"` }
Content holds the content of a scripture of the day.
type Resolver ¶
type Resolver interface { // Verse fetches a verse an associated metadata for the given reference.. Verse(ctx context.Context, ref *ref.Resolved) (*Verse, error) // VerseText turns a reference into a string of text. VerseText(ctx context.Context, ref *ref.Resolved) (string, error) // VerseHTML turns a reference into a string of HTML. VerseHTML(ctx context.Context, ref *ref.Resolved) (template.HTML, error) // VersionInformation returns the metadata for the version of the Bible // used for the verse. VersionInformation(ctx context.Context) (*Version, error) }
Resolver is the interface used to retrieve text for a scripture passage.
type Service ¶
type Service struct { Resolver Abbreviations *ref.BookAbbreviations Canon *ref.Canon }
func NewService ¶
func NewService(r Resolver, opt ...ServiceOption) *Service
func (*Service) RandomVerse ¶
func (*Service) RandomVerseHTML ¶
func (*Service) RandomVerseText ¶ added in v0.4.0
type ServiceOption ¶ added in v0.5.0
type ServiceOption func(*Service)
func WithAbbreviations ¶ added in v0.5.0
func WithAbbreviations(abbr *ref.BookAbbreviations) ServiceOption
func WithCanon ¶ added in v0.5.0
func WithCanon(c *ref.Canon) ServiceOption
func WithoutAbbreviations ¶ added in v0.5.0
func WithoutAbbreviations() ServiceOption
type Verse ¶ added in v0.4.0
type Verse struct { Reference string `yaml:"reference" json:"reference"` Content Content `yaml:"content" json:"content"` Link string `yaml:"link,omitempty" json:"link,omitempty"` Version Version `yaml:"version" json:"version"` }
Verse is the metadata and content for a verse of the day.
Click to show internal directories.
Click to hide internal directories.