Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

Commit 5631f95

Browse files
committed
feat(condition): update
1 parent 9799c62 commit 5631f95

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

condition/chain.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,20 @@ func WithOrValuesFunc(valueFunc func() []any) opts.Opt[ChainOperatorOpts] {
4646
}
4747
}
4848

49-
func NewChain() Chain {
50-
return Chain{}
49+
func NewChain(conditions ...Condition) Chain {
50+
return Chain{conditions: conditions}
5151
}
5252

53+
// Deprecated: Use NewChain instead
5354
func NewChainWithConditions(conditions ...Condition) Chain {
5455
return Chain{conditions: conditions}
5556
}
5657

58+
func (c Chain) AddCondition(condition Condition) Chain {
59+
c.conditions = append(c.conditions, condition)
60+
return c
61+
}
62+
5763
func (c Chain) addChain(field string, operator Operator, value any, op ...opts.Opt[ChainOperatorOpts]) Chain {
5864
o := opts.DefaultApply(op...)
5965
c.conditions = append(c.conditions, Condition{

0 commit comments

Comments
 (0)