Documentation
¶
Overview ¶
Please check out the _example filter for a pattern for creating new filters.
Index ¶
- type Chain
- func (c *Chain) Add(f Filterer) error
- func (c *Chain) Config() interface{}
- func (c *Chain) EventErrorCount() int
- func (c *Chain) EventErrorVelocity() int
- func (c *Chain) EventFilterCount() int
- func (c *Chain) EventFilterVelocity() int
- func (c *Chain) EventSuccessCount() int
- func (c *Chain) EventSuccessVelocity() int
- func (c *Chain) EventTs() int64
- func (c *Chain) Filter(e event.Event) []event.Event
- func (c *Chain) Filterers() []Filterer
- func (c *Chain) Name() string
- func (c *Chain) Plugin() string
- func (c *Chain) Tenant() tenant.Id
- type Chainer
- type ChainerMock
- func (mock *ChainerMock) Add(f Filterer) error
- func (mock *ChainerMock) AddCalls() []struct{ ... }
- func (mock *ChainerMock) Config() interface{}
- func (mock *ChainerMock) ConfigCalls() []struct{}
- func (mock *ChainerMock) EventErrorCount() int
- func (mock *ChainerMock) EventErrorVelocity() int
- func (mock *ChainerMock) EventFilterCount() int
- func (mock *ChainerMock) EventFilterVelocity() int
- func (mock *ChainerMock) EventSuccessCount() int
- func (mock *ChainerMock) EventSuccessVelocity() int
- func (mock *ChainerMock) EventTs() int64
- func (mock *ChainerMock) Filter(e event.Event) []event.Event
- func (mock *ChainerMock) FilterCalls() []struct{ ... }
- func (mock *ChainerMock) Filterers() []Filterer
- func (mock *ChainerMock) FilterersCalls() []struct{}
- func (mock *ChainerMock) Name() string
- func (mock *ChainerMock) NameCalls() []struct{}
- func (mock *ChainerMock) Plugin() string
- func (mock *ChainerMock) PluginCalls() []struct{}
- func (mock *ChainerMock) Tenant() tenant.Id
- func (mock *ChainerMock) TenantCalls() []struct{}
- type Filterer
- type FiltererMock
- func (mock *FiltererMock) Config() interface{}
- func (mock *FiltererMock) ConfigCalls() []struct{}
- func (mock *FiltererMock) EventErrorCount() int
- func (mock *FiltererMock) EventErrorVelocity() int
- func (mock *FiltererMock) EventFilterCount() int
- func (mock *FiltererMock) EventFilterVelocity() int
- func (mock *FiltererMock) EventSuccessCount() int
- func (mock *FiltererMock) EventSuccessVelocity() int
- func (mock *FiltererMock) EventTs() int64
- func (mock *FiltererMock) Filter(e event.Event) []event.Event
- func (mock *FiltererMock) FilterCalls() []struct{ ... }
- func (mock *FiltererMock) Name() string
- func (mock *FiltererMock) NameCalls() []struct{}
- func (mock *FiltererMock) Plugin() string
- func (mock *FiltererMock) PluginCalls() []struct{}
- func (mock *FiltererMock) Tenant() tenant.Id
- func (mock *FiltererMock) TenantCalls() []struct{}
- type Hasher
- type HasherMock
- type InvalidArgumentError
- type InvalidConfigError
- type NewFilterer
- type NewFiltererMock
- func (mock *NewFiltererMock) FiltererHash(config interface{}) (string, error)
- func (mock *NewFiltererMock) FiltererHashCalls() []struct{ ... }
- func (mock *NewFiltererMock) NewFilterer(tid tenant.Id, plugin string, name string, config interface{}, ...) (Filterer, error)
- func (mock *NewFiltererMock) NewFiltererCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chain ¶
func (*Chain) EventErrorCount ¶ added in v1.1.2
func (*Chain) EventErrorVelocity ¶ added in v1.1.2
func (*Chain) EventFilterCount ¶ added in v1.1.2
func (*Chain) EventFilterVelocity ¶ added in v1.1.2
func (*Chain) EventSuccessCount ¶ added in v1.1.2
func (*Chain) EventSuccessVelocity ¶ added in v1.1.2
type Chainer ¶
type Chainer interface {
Filterer
// Add will add a filterer to the chain
Add(f Filterer) error
Filterers() []Filterer
}
Chainer
type ChainerMock ¶
type ChainerMock struct {
// AddFunc mocks the Add method.
AddFunc func(f Filterer) error
// ConfigFunc mocks the Config method.
ConfigFunc func() interface{}
// FilterFunc mocks the Filter method.
FilterFunc func(e event.Event) []event.Event
// FilterersFunc mocks the Filterers method.
FilterersFunc func() []Filterer
// NameFunc mocks the Name method.
NameFunc func() string
// PluginFunc mocks the Plugin method.
PluginFunc func() string
// TenantFunc mocks the Tenant method.
TenantFunc func() tenant.Id
// contains filtered or unexported fields
}
ChainerMock is a mock implementation of Chainer.
func TestSomethingThatUsesChainer(t *testing.T) {
// make and configure a mocked Chainer
mockedChainer := &ChainerMock{
AddFunc: func(f Filterer) error {
panic("mock out the Add method")
},
ConfigFunc: func() interface{} {
panic("mock out the Config method")
},
FilterFunc: func(e event.Event) []event.Event {
panic("mock out the Filter method")
},
FilterersFunc: func() []Filterer {
panic("mock out the Filterers method")
},
NameFunc: func() string {
panic("mock out the Name method")
},
PluginFunc: func() string {
panic("mock out the Plugin method")
},
TenantFunc: func() tenant.Id {
panic("mock out the Tenant method")
},
}
// use mockedChainer in code that requires Chainer
// and then make assertions.
}
func (*ChainerMock) AddCalls ¶
func (mock *ChainerMock) AddCalls() []struct { F Filterer }
AddCalls gets all the calls that were made to Add. Check the length with:
len(mockedChainer.AddCalls())
func (*ChainerMock) Config ¶ added in v0.2.1
func (mock *ChainerMock) Config() interface{}
Config calls ConfigFunc.
func (*ChainerMock) ConfigCalls ¶ added in v0.2.1
func (mock *ChainerMock) ConfigCalls() []struct { }
ConfigCalls gets all the calls that were made to Config. Check the length with:
len(mockedChainer.ConfigCalls())
func (*ChainerMock) EventErrorCount ¶ added in v1.1.2
func (mock *ChainerMock) EventErrorCount() int
func (*ChainerMock) EventErrorVelocity ¶ added in v1.1.2
func (mock *ChainerMock) EventErrorVelocity() int
func (*ChainerMock) EventFilterCount ¶ added in v1.1.2
func (mock *ChainerMock) EventFilterCount() int
func (*ChainerMock) EventFilterVelocity ¶ added in v1.1.2
func (mock *ChainerMock) EventFilterVelocity() int
func (*ChainerMock) EventSuccessCount ¶ added in v1.1.2
func (mock *ChainerMock) EventSuccessCount() int
func (*ChainerMock) EventSuccessVelocity ¶ added in v1.1.2
func (mock *ChainerMock) EventSuccessVelocity() int
func (*ChainerMock) EventTs ¶ added in v1.1.2
func (mock *ChainerMock) EventTs() int64
func (*ChainerMock) Filter ¶
func (mock *ChainerMock) Filter(e event.Event) []event.Event
Filter calls FilterFunc.
func (*ChainerMock) FilterCalls ¶
func (mock *ChainerMock) FilterCalls() []struct { E event.Event }
FilterCalls gets all the calls that were made to Filter. Check the length with:
len(mockedChainer.FilterCalls())
func (*ChainerMock) Filterers ¶
func (mock *ChainerMock) Filterers() []Filterer
Filterers calls FilterersFunc.
func (*ChainerMock) FilterersCalls ¶
func (mock *ChainerMock) FilterersCalls() []struct { }
FilterersCalls gets all the calls that were made to Filterers. Check the length with:
len(mockedChainer.FilterersCalls())
func (*ChainerMock) Name ¶ added in v0.2.1
func (mock *ChainerMock) Name() string
Name calls NameFunc.
func (*ChainerMock) NameCalls ¶ added in v0.2.1
func (mock *ChainerMock) NameCalls() []struct { }
NameCalls gets all the calls that were made to Name. Check the length with:
len(mockedChainer.NameCalls())
func (*ChainerMock) Plugin ¶ added in v0.2.1
func (mock *ChainerMock) Plugin() string
Plugin calls PluginFunc.
func (*ChainerMock) PluginCalls ¶ added in v0.2.1
func (mock *ChainerMock) PluginCalls() []struct { }
PluginCalls gets all the calls that were made to Plugin. Check the length with:
len(mockedChainer.PluginCalls())
func (*ChainerMock) Tenant ¶ added in v0.3.0
func (mock *ChainerMock) Tenant() tenant.Id
Tenant calls TenantFunc.
func (*ChainerMock) TenantCalls ¶ added in v0.3.0
func (mock *ChainerMock) TenantCalls() []struct { }
TenantCalls gets all the calls that were made to Tenant. Check the length with:
len(mockedChainer.TenantCalls())
type Filterer ¶
type Filterer interface {
Filter(e event.Event) []event.Event
Config() interface{}
Name() string
Plugin() string
Tenant() tenant.Id
EventSuccessCount() int
EventSuccessVelocity() int
EventFilterCount() int
EventFilterVelocity() int
EventErrorCount() int
EventErrorVelocity() int
EventTs() int64
}
Filterer defines the interface that a filterer must implement
type FiltererMock ¶
type FiltererMock struct {
// ConfigFunc mocks the Config method.
ConfigFunc func() interface{}
// FilterFunc mocks the Filter method.
FilterFunc func(e event.Event) []event.Event
// NameFunc mocks the Name method.
NameFunc func() string
// PluginFunc mocks the Plugin method.
PluginFunc func() string
// TenantFunc mocks the Tenant method.
TenantFunc func() tenant.Id
// contains filtered or unexported fields
}
FiltererMock is a mock implementation of Filterer.
func TestSomethingThatUsesFilterer(t *testing.T) {
// make and configure a mocked Filterer
mockedFilterer := &FiltererMock{
ConfigFunc: func() interface{} {
panic("mock out the Config method")
},
FilterFunc: func(e event.Event) []event.Event {
panic("mock out the Filter method")
},
NameFunc: func() string {
panic("mock out the Name method")
},
PluginFunc: func() string {
panic("mock out the Plugin method")
},
TenantFunc: func() tenant.Id {
panic("mock out the Tenant method")
},
}
// use mockedFilterer in code that requires Filterer
// and then make assertions.
}
func (*FiltererMock) Config ¶ added in v0.2.1
func (mock *FiltererMock) Config() interface{}
Config calls ConfigFunc.
func (*FiltererMock) ConfigCalls ¶ added in v0.2.1
func (mock *FiltererMock) ConfigCalls() []struct { }
ConfigCalls gets all the calls that were made to Config. Check the length with:
len(mockedFilterer.ConfigCalls())
func (*FiltererMock) EventErrorCount ¶ added in v1.1.2
func (mock *FiltererMock) EventErrorCount() int
func (*FiltererMock) EventErrorVelocity ¶ added in v1.1.2
func (mock *FiltererMock) EventErrorVelocity() int
func (*FiltererMock) EventFilterCount ¶ added in v1.1.2
func (mock *FiltererMock) EventFilterCount() int
func (*FiltererMock) EventFilterVelocity ¶ added in v1.1.2
func (mock *FiltererMock) EventFilterVelocity() int
func (*FiltererMock) EventSuccessCount ¶ added in v1.1.2
func (mock *FiltererMock) EventSuccessCount() int
func (*FiltererMock) EventSuccessVelocity ¶ added in v1.1.2
func (mock *FiltererMock) EventSuccessVelocity() int
func (*FiltererMock) EventTs ¶ added in v1.1.2
func (mock *FiltererMock) EventTs() int64
func (*FiltererMock) Filter ¶
func (mock *FiltererMock) Filter(e event.Event) []event.Event
Filter calls FilterFunc.
func (*FiltererMock) FilterCalls ¶
func (mock *FiltererMock) FilterCalls() []struct { E event.Event }
FilterCalls gets all the calls that were made to Filter. Check the length with:
len(mockedFilterer.FilterCalls())
func (*FiltererMock) Name ¶ added in v0.2.1
func (mock *FiltererMock) Name() string
Name calls NameFunc.
func (*FiltererMock) NameCalls ¶ added in v0.2.1
func (mock *FiltererMock) NameCalls() []struct { }
NameCalls gets all the calls that were made to Name. Check the length with:
len(mockedFilterer.NameCalls())
func (*FiltererMock) Plugin ¶ added in v0.2.1
func (mock *FiltererMock) Plugin() string
Plugin calls PluginFunc.
func (*FiltererMock) PluginCalls ¶ added in v0.2.1
func (mock *FiltererMock) PluginCalls() []struct { }
PluginCalls gets all the calls that were made to Plugin. Check the length with:
len(mockedFilterer.PluginCalls())
func (*FiltererMock) Tenant ¶ added in v0.3.0
func (mock *FiltererMock) Tenant() tenant.Id
Tenant calls TenantFunc.
func (*FiltererMock) TenantCalls ¶ added in v0.3.0
func (mock *FiltererMock) TenantCalls() []struct { }
TenantCalls gets all the calls that were made to Tenant. Check the length with:
len(mockedFilterer.TenantCalls())
type Hasher ¶
type Hasher interface {
// FiltererHash calculates the hash of a filterer based on the
// given configuration
FiltererHash(config interface{}) (string, error)
}
Hasher defines the hashing interface that a receiver needs to implement
type HasherMock ¶
type HasherMock struct {
// FiltererHashFunc mocks the FiltererHash method.
FiltererHashFunc func(config interface{}) (string, error)
// contains filtered or unexported fields
}
HasherMock is a mock implementation of Hasher.
func TestSomethingThatUsesHasher(t *testing.T) {
// make and configure a mocked Hasher
mockedHasher := &HasherMock{
FiltererHashFunc: func(config interface{}) (string, error) {
panic("mock out the FiltererHash method")
},
}
// use mockedHasher in code that requires Hasher
// and then make assertions.
}
func (*HasherMock) FiltererHash ¶
func (mock *HasherMock) FiltererHash(config interface{}) (string, error)
FiltererHash calls FiltererHashFunc.
func (*HasherMock) FiltererHashCalls ¶
func (mock *HasherMock) FiltererHashCalls() []struct { Config interface{} }
FiltererHashCalls gets all the calls that were made to FiltererHash. Check the length with:
len(mockedHasher.FiltererHashCalls())
type InvalidArgumentError ¶
type InvalidArgumentError struct {
Err error
}
func (*InvalidArgumentError) Error ¶
func (e *InvalidArgumentError) Error() string
func (*InvalidArgumentError) Unwrap ¶
func (e *InvalidArgumentError) Unwrap() error
type InvalidConfigError ¶
type InvalidConfigError struct {
Err error
}
InvalidConfigError is returned when a configuration parameter results in a plugin error
func (*InvalidConfigError) Error ¶
func (e *InvalidConfigError) Error() string
func (*InvalidConfigError) Unwrap ¶
func (e *InvalidConfigError) Unwrap() error
type NewFilterer ¶
type NewFilterer interface {
Hasher
// NewFilterer returns an object that implements the Filterer interface
NewFilterer(tid tenant.Id, plugin string, name string, config interface{}, secrets secret.Vault, tableSyncer syncer.DeltaSyncer) (Filterer, error)
}
NewFilterer defines the interface on how to to create a new filterer
type NewFiltererMock ¶
type NewFiltererMock struct {
// FiltererHashFunc mocks the FiltererHash method.
FiltererHashFunc func(config interface{}) (string, error)
// NewFiltererFunc mocks the NewFilterer method.
NewFiltererFunc func(tid tenant.Id, plugin string, name string, config interface{}, secrets secret.Vault, tableSyncer syncer.DeltaSyncer) (Filterer, error)
// contains filtered or unexported fields
}
NewFiltererMock is a mock implementation of NewFilterer.
func TestSomethingThatUsesNewFilterer(t *testing.T) {
// make and configure a mocked NewFilterer
mockedNewFilterer := &NewFiltererMock{
FiltererHashFunc: func(config interface{}) (string, error) {
panic("mock out the FiltererHash method")
},
NewFiltererFunc: func(tid tenant.Id, plugin string, name string, config interface{}, secrets secret.Vault) (Filterer, error) {
panic("mock out the NewFilterer method")
},
}
// use mockedNewFilterer in code that requires NewFilterer
// and then make assertions.
}
func (*NewFiltererMock) FiltererHash ¶
func (mock *NewFiltererMock) FiltererHash(config interface{}) (string, error)
FiltererHash calls FiltererHashFunc.
func (*NewFiltererMock) FiltererHashCalls ¶
func (mock *NewFiltererMock) FiltererHashCalls() []struct { Config interface{} }
FiltererHashCalls gets all the calls that were made to FiltererHash. Check the length with:
len(mockedNewFilterer.FiltererHashCalls())
func (*NewFiltererMock) NewFilterer ¶
func (mock *NewFiltererMock) NewFilterer(tid tenant.Id, plugin string, name string, config interface{}, secrets secret.Vault, tableSyncer syncer.DeltaSyncer) (Filterer, error)
NewFilterer calls NewFiltererFunc.
func (*NewFiltererMock) NewFiltererCalls ¶
func (mock *NewFiltererMock) NewFiltererCalls() []struct { Tid tenant.Id Plugin string Name string Config interface{} Secrets secret.Vault }
NewFiltererCalls gets all the calls that were made to NewFilterer. Check the length with:
len(mockedNewFilterer.NewFiltererCalls())
Directories
¶
| Path | Synopsis |
|---|---|
|
Install go-enum by `go get -u github.com/searKing/golang/tools/go-enum`
|
Install go-enum by `go get -u github.com/searKing/golang/tools/go-enum` |