Documentation
¶
Overview ¶
Package gs_cond provides many conditions used when registering bean.
Package cond is a generated GoMock package.
Index ¶
- func And(cond ...gs.Condition) gs.Condition
- func None(cond ...gs.Condition) gs.Condition
- func Not(c gs.Condition) gs.Condition
- func OK() gs.Condition
- func Or(cond ...gs.Condition) gs.Condition
- func RegisterExprFunc(name string, fn interface{})
- type Conditional
- func New() *Conditional
- func On(cond gs.Condition) *Conditional
- func OnBean(selector gs.BeanSelector) *Conditional
- func OnExpression(expression string) *Conditional
- func OnMatches(fn func(ctx gs.CondContext) (bool, error)) *Conditional
- func OnMissingBean(selector gs.BeanSelector) *Conditional
- func OnMissingProperty(name string) *Conditional
- func OnProfile(profile string) *Conditional
- func OnProperty(name string, options ...PropertyOption) *Conditional
- func OnSingleBean(selector gs.BeanSelector) *Conditional
- func (c *Conditional) And() *Conditional
- func (c *Conditional) Matches(ctx gs.CondContext) (bool, error)
- func (c *Conditional) On(cond gs.Condition) *Conditional
- func (c *Conditional) OnBean(selector gs.BeanSelector) *Conditional
- func (c *Conditional) OnExpression(expression string) *Conditional
- func (c *Conditional) OnMatches(fn func(ctx gs.CondContext) (bool, error)) *Conditional
- func (c *Conditional) OnMissingBean(selector gs.BeanSelector) *Conditional
- func (c *Conditional) OnMissingProperty(name string) *Conditional
- func (c *Conditional) OnProfile(profile string) *Conditional
- func (c *Conditional) OnProperty(name string, options ...PropertyOption) *Conditional
- func (c *Conditional) OnSingleBean(selector gs.BeanSelector) *Conditional
- func (c *Conditional) Or() *Conditional
- type FuncCond
- type MockCondition
- type MockConditionMockRecorder
- type MockContext
- type MockContextMockRecorder
- type Operator
- type PropertyOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterExprFunc ¶
func RegisterExprFunc(name string, fn interface{})
Types ¶
type Conditional ¶
type Conditional struct {
// contains filtered or unexported fields
}
Conditional is a Condition implemented by link of Condition(s).
func On ¶
func On(cond gs.Condition) *Conditional
On returns a Conditional that starts with one Condition.
func OnBean ¶
func OnBean(selector gs.BeanSelector) *Conditional
OnBean returns a Conditional that starts with a Condition that returns true when finding more than one beans.
func OnExpression ¶
func OnExpression(expression string) *Conditional
OnExpression returns a Conditional that starts with a Condition that returns true when an expression returns true.
func OnMatches ¶
func OnMatches(fn func(ctx gs.CondContext) (bool, error)) *Conditional
OnMatches returns a Conditional that starts with a Condition that returns true when function returns true.
func OnMissingBean ¶
func OnMissingBean(selector gs.BeanSelector) *Conditional
OnMissingBean returns a Conditional that starts with a Condition that returns true when finding no beans.
func OnMissingProperty ¶
func OnMissingProperty(name string) *Conditional
OnMissingProperty returns a Conditional that starts with a Condition that returns true when property doesn't exist.
func OnProfile ¶
func OnProfile(profile string) *Conditional
OnProfile returns a Conditional that starts with a Condition that returns true when property value equals to profile.
func OnProperty ¶
func OnProperty(name string, options ...PropertyOption) *Conditional
OnProperty returns a Conditional that starts with a Condition that checks a property and its value.
func OnSingleBean ¶
func OnSingleBean(selector gs.BeanSelector) *Conditional
OnSingleBean returns a Conditional that starts with a Condition that returns true when finding only one bean.
func (*Conditional) Matches ¶
func (c *Conditional) Matches(ctx gs.CondContext) (bool, error)
func (*Conditional) On ¶
func (c *Conditional) On(cond gs.Condition) *Conditional
On adds one Condition.
func (*Conditional) OnBean ¶
func (c *Conditional) OnBean(selector gs.BeanSelector) *Conditional
OnBean adds a Condition that returns true when finding more than one beans.
func (*Conditional) OnExpression ¶
func (c *Conditional) OnExpression(expression string) *Conditional
OnExpression adds a Condition that returns true when an expression returns true.
func (*Conditional) OnMatches ¶
func (c *Conditional) OnMatches(fn func(ctx gs.CondContext) (bool, error)) *Conditional
OnMatches adds a Condition that returns true when function returns true.
func (*Conditional) OnMissingBean ¶
func (c *Conditional) OnMissingBean(selector gs.BeanSelector) *Conditional
OnMissingBean adds a Condition that returns true when finding no beans.
func (*Conditional) OnMissingProperty ¶
func (c *Conditional) OnMissingProperty(name string) *Conditional
OnMissingProperty adds a Condition that returns true when property doesn't exist.
func (*Conditional) OnProfile ¶
func (c *Conditional) OnProfile(profile string) *Conditional
OnProfile adds a Condition that returns true when property value equals to profile.
func (*Conditional) OnProperty ¶
func (c *Conditional) OnProperty(name string, options ...PropertyOption) *Conditional
OnProperty adds a Condition that checks a property and its value.
func (*Conditional) OnSingleBean ¶
func (c *Conditional) OnSingleBean(selector gs.BeanSelector) *Conditional
OnSingleBean adds a Condition that returns true when finding only one bean.
type MockCondition ¶
type MockCondition struct {
// contains filtered or unexported fields
}
MockCondition is a mock of Condition interface.
func NewMockCondition ¶
func NewMockCondition(ctrl *gomock.Controller) *MockCondition
NewMockCondition creates a new mock instance.
func (*MockCondition) EXPECT ¶
func (m *MockCondition) EXPECT() *MockConditionMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockCondition) Matches ¶
func (m *MockCondition) Matches(ctx gs.CondContext) (bool, error)
Matches mocks base method.
type MockConditionMockRecorder ¶
type MockConditionMockRecorder struct {
// contains filtered or unexported fields
}
MockConditionMockRecorder is the mock recorder for MockCondition.
type MockContext ¶
type MockContext struct {
// contains filtered or unexported fields
}
MockContext is a mock of Context interface.
func NewMockContext ¶
func NewMockContext(ctrl *gomock.Controller) *MockContext
NewMockContext creates a new mock instance.
func (*MockContext) EXPECT ¶
func (m *MockContext) EXPECT() *MockContextMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockContext) Find ¶
func (m *MockContext) Find(selector gs.BeanSelector) ([]gs.CondBean, error)
Find mocks base method.
type MockContextMockRecorder ¶
type MockContextMockRecorder struct {
// contains filtered or unexported fields
}
MockContextMockRecorder is the mock recorder for MockContext.
func (*MockContextMockRecorder) Find ¶
func (mr *MockContextMockRecorder) Find(selector any) *gomock.Call
Find indicates an expected call of Find.
type Operator ¶
type Operator int
Operator defines operation between conditions, including Or、And、None.
type PropertyOption ¶
type PropertyOption func(*onProperty)
func HavingValue ¶
func HavingValue(havingValue string) PropertyOption
HavingValue sets a Condition to return true when property value equals to havingValue.
func MatchIfMissing ¶
func MatchIfMissing() PropertyOption
MatchIfMissing sets a Condition to return true when property doesn't exist.