mirror of
https://github.com/PrivateCaptcha/PrivateCaptcha.git
synced 2026-02-12 00:39:29 -06:00
39 lines
606 B
Go
39 lines
606 B
Go
package common
|
|
|
|
import "time"
|
|
|
|
type TimePeriod int
|
|
|
|
const (
|
|
TimePeriodToday TimePeriod = iota
|
|
TimePeriodWeek TimePeriod = iota
|
|
TimePeriodMonth TimePeriod = iota
|
|
TimePeriodYear TimePeriod = iota
|
|
)
|
|
|
|
func (tp TimePeriod) String() string {
|
|
switch tp {
|
|
case TimePeriodToday:
|
|
return "today"
|
|
case TimePeriodWeek:
|
|
return "week"
|
|
case TimePeriodMonth:
|
|
return "month"
|
|
case TimePeriodYear:
|
|
return "year"
|
|
default:
|
|
return "unknown"
|
|
}
|
|
}
|
|
|
|
type TimePeriodStat struct {
|
|
Timestamp time.Time
|
|
RequestsCount int
|
|
VerifiesCount int
|
|
}
|
|
|
|
type TimeCount struct {
|
|
Timestamp time.Time
|
|
Count uint32
|
|
}
|