gs_cond

package
v1.2.0-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package gs_cond provides many conditions used when registering bean.

Package cond is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func And

func And(cond ...gs.Condition) gs.Condition

func None

func None(cond ...gs.Condition) gs.Condition

func Not

func Not(c gs.Condition) gs.Condition

Not returns a Condition that negating to another.

func OK

func OK() gs.Condition

OK returns a Condition that always returns true.

func Or

func Or(cond ...gs.Condition) gs.Condition

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 New

func New() *Conditional

New returns 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) And

func (c *Conditional) And() *Conditional

And sets a And operator.

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.

func (*Conditional) Or

func (c *Conditional) Or() *Conditional

Or sets a Or operator.

type FuncCond

type FuncCond func(ctx gs.CondContext) (bool, error)

func (FuncCond) Matches

func (c FuncCond) Matches(ctx gs.CondContext) (bool, error)

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

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.

func (*MockConditionMockRecorder) Matches

func (mr *MockConditionMockRecorder) Matches(ctx any) *gomock.Call

Matches indicates an expected call of Matches.

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.

func (*MockContext) Has

func (m *MockContext) Has(key string) bool

Has mocks base method.

func (*MockContext) Prop

func (m *MockContext) Prop(key string, opts ...conf.GetOption) string

Prop 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.

func (*MockContextMockRecorder) Has

func (mr *MockContextMockRecorder) Has(key any) *gomock.Call

Has indicates an expected call of Has.

func (*MockContextMockRecorder) Prop

func (mr *MockContextMockRecorder) Prop(key any, opts ...any) *gomock.Call

Prop indicates an expected call of Prop.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL