Esempio n. 1
0
func title(span timespan.Span, articles []string) string {
	return fmt.Sprintf(
		"Reading note on %s ~ %s",
		span.Start().Format("2006.01.02"),
		span.End().Format("2006.01.02"),
	)
}
Esempio n. 2
0
File: brain.go Progetto: bcho/read
func (b brain) GetInPeriod(period timespan.Span) []string {
	b.l.RLock()
	defer b.l.RUnlock()

	i := sort.Search(
		len(b.periodIndex),
		func(i int) bool {
			return period.ContainsTime(b.periodIndex[i].At)
		},
	)

	rv := []string{}
	for ; i < len(b.periodIndex); i++ {
		if !period.ContainsTime(b.periodIndex[i].At) {
			break
		}
		rv = append(rv, b.periodIndex[i].Payload)
	}

	return rv
}