types.go 621 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package xstream
  2. import (
  3. "context"
  4. )
  5. type Emitter interface {
  6. AddOutput(chan<- interface{}, string)
  7. }
  8. type Source interface {
  9. Emitter
  10. Open(context context.Context) error
  11. }
  12. type Collector interface {
  13. GetInput() (chan<- interface{}, string)
  14. }
  15. type Sink interface {
  16. Collector
  17. Open(context.Context, chan<- error)
  18. }
  19. type Operator interface{
  20. Emitter
  21. Collector
  22. Exec(context context.Context) error
  23. }
  24. type TopNode interface{
  25. GetName() string
  26. }
  27. type Rule struct{
  28. Id string `json:"id"`
  29. Sql string `json:"sql"`
  30. Actions []map[string]interface{} `json:"actions"`
  31. Options map[string]interface{} `json:"options"`
  32. }