26 lines
614 B
Go
26 lines
614 B
Go
package store
|
|
|
|
import "github.uio.no/torjus/apiary/models"
|
|
|
|
type LoginStats string
|
|
|
|
const (
|
|
LoginStatsUndefined LoginStats = ""
|
|
LoginStatsPasswords LoginStats = "password"
|
|
LoginStatsCountry LoginStats = "country"
|
|
LoginStatsIP LoginStats = "ips"
|
|
LoginStatsUsername LoginStats = "username"
|
|
LoginStatsTotals LoginStats = "totals"
|
|
)
|
|
|
|
type StatsResult struct {
|
|
Name string `json:"name"`
|
|
Count int `json:"count"`
|
|
}
|
|
|
|
type LoginAttemptStore interface {
|
|
AddAttempt(l *models.LoginAttempt) error
|
|
All() ([]models.LoginAttempt, error)
|
|
Stats(statType LoginStats, limit int) ([]StatsResult, error)
|
|
}
|