added docs
parent
73c5e4bfaf
commit
5c25e91116
|
@ -1,6 +1,12 @@
|
||||||
package flog
|
package flog
|
||||||
|
|
||||||
|
|
||||||
|
// NewFilteredRouter returns an initialized FilteredRouter.
|
||||||
|
//
|
||||||
|
// 'subrouter' is the sub-router that a FilteredRouter will
|
||||||
|
// re-Route a 'message' (and 'context') to, but only on the
|
||||||
|
// condition that 'filterFn' returns 'true' for the 'message'
|
||||||
|
// and 'context' passed to it.
|
||||||
func NewFilteredRouter(subrouter Router, filterFn func(string, map[string]interface{})bool) *FilteredRouter {
|
func NewFilteredRouter(subrouter Router, filterFn func(string, map[string]interface{})bool) *FilteredRouter {
|
||||||
router := FilteredRouter{
|
router := FilteredRouter{
|
||||||
subrouter:subrouter,
|
subrouter:subrouter,
|
||||||
|
@ -11,6 +17,7 @@ func NewFilteredRouter(subrouter Router, filterFn func(string, map[string]interf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// FilteredRouter is a Router that conditionally routes or discards a message (and its context).
|
||||||
type FilteredRouter struct {
|
type FilteredRouter struct {
|
||||||
subrouter Router
|
subrouter Router
|
||||||
filterFn func(string, map[string]interface{})bool
|
filterFn func(string, map[string]interface{})bool
|
||||||
|
|
Loading…
Reference in New Issue