verses

package
v0.0.0-...-9029f94 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2018 License: GPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTree = BTree{btree.New(2)}

DefaultTree is the default instance of the tree

Functions

func Update

func Update(path string) error

Update adds new verses to default tree

Types

type BTree

type BTree struct {
	*btree.BTree
}

BTree wrapps the btree package

func (*BTree) Add

func (tree *BTree) Add(verses []Verse) error

Add adds verses to the binary tree

func (*BTree) GetRange

func (tree *BTree) GetRange(start, end time.Time) ([]Verse, error)

GetRange returns an array of verses of a time interval

func (*BTree) GetVerse

func (tree *BTree) GetVerse(date time.Time) (Verse, error)

GetVerse returns a verse based on a date

func (*BTree) Update

func (tree *BTree) Update(path string) error

Update adds new verses to tree

type Verse

type Verse struct {
	Date         customTime `xml:"Datum" json:"date"`
	Day          string     `xml:"Wtag"  json:"weekday"`
	Sunday       string     `xml:"Sonntag" json:"sunday_name"`
	Text         string     `xml:"Losungstext" json:"verse"`
	Reference    string     `xml:"Losungsvers" json:"reference"`
	Teaching     string     `xml:"Lehrtext" json:"teaching"`
	TeachingRef  string     `xml:"Lehrtextvers" json:"teaching_reference"`
	TermsOfUse   string     `json:"terms_of_use"`
	Bibliography string     `json:"bibliography"`
}

Verse is the representation of a verse

func GetRange

func GetRange(start, end time.Time) ([]Verse, error)

GetRange returns an array of verses of a time interval

func GetVerse

func GetVerse(date time.Time) (Verse, error)

GetVerse returns a verse based on a date

func ImportVerses

func ImportVerses(dirPath string) ([]Verse, error)

ImportVerses loads all verses from a directory and returns them as slice

func (Verse) Less

func (v Verse) Less(than btree.Item) bool

Less is the compare function for the tree

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL