14 lines
208 B
Go
14 lines
208 B
Go
package limiter
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
var ErrLimitReached = fmt.Errorf("limit reached")
|
|
|
|
type Limiter interface {
|
|
Limit(ctx context.Context, key string) (waitFor time.Duration, err error)
|
|
}
|