Add separate timespan options for convenience

Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
Vartan Benohanian
2020-07-27 22:26:29 -04:00
parent c852306cb2
commit ff682a6e70
3 changed files with 31 additions and 38 deletions
-31
View File
@@ -55,37 +55,6 @@ func (s Sort) String() string {
return sorts[s]
}
// Timespan is a timespan option.
// E.g. "hour" means in the last hour, "all" means all-time.
// It is used when conducting searches.
type Timespan int
var timespans = [...]string{
"hour",
"day",
"week",
"month",
"year",
"all",
}
// Different timespan options.
const (
TimespanHour Timespan = iota
TimespanDay
TimespanWeek
TimespanMonth
TimespanYear
TimespanAll
)
func (t Timespan) String() string {
if t < TimespanHour || t > TimespanAll {
return ""
}
return timespans[t]
}
// Permalink is the link to a post or comment.
type Permalink string