Exemple #1
0
func New() Users {
	var r Reader
	if p, err := backends.Open(config.UserReader); err != nil {
		log.Fatal("No 'user' reader available")
	} else {
		if o, ok := p.(Reader); !ok {
			log.Fatal("Invalid 'user' reader")
		} else {
			r = o
		}
	}
	return NewUsersFn(r)
}
Exemple #2
0
func New() Articles {
	var r Reader
	if p, err := backends.Open("wombat:apps:article-reader"); err != nil {
		log.Fatal("No 'article' reader available")
	} else {
		if o, ok := p.(Reader); !ok {
			log.Fatal("Invalid 'article' reader")
		} else {
			r = o
		}
	}
	return Articles{r}
}
Exemple #3
0
func NewArticle(title string) *Article {
	if p, err := backends.Open("wombat:apps:article-printer"); err != nil {
		log.Println("No 'article' printer available")
	} else {
		if printer, ok := p.(Printer); !ok {
			log.Println("Invalid 'article' printer")
		} else {
			tp, t := titlePathTime(title)
			return &Article{Printer: printer,
				Title:     title,
				TitlePath: tp,
				Created:   t}
		}
	}
	return nil
}