Files
PrivateCaptcha/pkg/common/timecount.go
2025-12-07 17:53:30 +01:00

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
}