增加默认的空实现

This commit is contained in:
白茶清欢 2024-06-24 15:05:49 +08:00
parent a2fe3a0be7
commit 607d407b62

28
default.go Normal file
View File

@ -0,0 +1,28 @@
// Package rate_limit ...
//
// Description : rate_limit ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2024-06-24 15:04
package rate_limit
import (
"context"
"git.zhangdeman.cn/zhangdeman/rate_limit/define"
)
var (
DefaultClient = &Default{}
)
type Default struct {
}
func (d Default) AllowN(ctx context.Context, limitCfg *define.LimitConfig, tokenCnt int) (bool, error) {
return true, nil
}
func (d Default) Reset(ctx context.Context, limitCfg *define.LimitConfig) error {
return nil
}