Documentation
¶
Index ¶
Constants ¶
View Source
const DemoLimit = uint64(30000)
View Source
const DemoRuleName = "demo"
Variables ¶
View Source
var ( DemoCheckSuccess = &toddler.CheckResult{ OK: true, Limit: DemoLimit, } DemoCheckFail = &toddler.CheckResult{ OK: false, Limit: DemoLimit, Message: "xxxx", } )
Functions ¶
This section is empty.
Types ¶
type DemoCheckRequest ¶
type DemoCheckRequest struct {
Amount uint64 `gorm:"column:amount" json:"amount"`
}
type DemoCreator ¶
type DemoCreator struct{}
func NewDemoCreator ¶
func NewDemoCreator() *DemoCreator
func (*DemoCreator) Create ¶
func (d *DemoCreator) Create(resource *Resource) IRule
type DemoRule ¶
type DemoRule struct{}
func NewDemoRule ¶
func NewDemoRule() *DemoRule
func (*DemoRule) MakeEffective ¶
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
func NewFactory ¶
func (*Factory) GetAllRuleCreators ¶
func (f *Factory) GetAllRuleCreators() map[string]IRuleCreator
func (*Factory) GetAllRuleNames ¶
type IRule ¶
type IRule interface { // Check 检查是否符合规则 Check(map[string]interface{}) (*toddler.CheckResult, error) MakeEffective() error }
IRule rule interface
type IRuleCreator ¶
IRuleCreator 为工厂提供统一的创建方法
Click to show internal directories.
Click to hide internal directories.