Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions rate.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,22 @@ func PerHour(rate int) Limit {
}
}

func PerDay(rate int) Limit {
return Limit{
Rate: rate,
Period: time.Hour * 24,
Burst: rate,
}
}

func Per(rate int, period time.Duration) Limit {
return Limit{
Rate: rate,
Period: period,
Burst: rate,
}
}

// ------------------------------------------------------------------------------

// Limiter controls how frequently events are allowed to happen.
Expand Down