echo.go 464 B

123456789101112131415161718192021222324252627
  1. package main
  2. import (
  3. "fmt"
  4. "github.com/emqx/kuiper/xstream/api"
  5. )
  6. type echo struct {
  7. }
  8. func (f *echo) Validate(args []interface{}) error {
  9. if len(args) != 1 {
  10. return fmt.Errorf("echo function only supports 1 parameter but got %d", len(args))
  11. }
  12. return nil
  13. }
  14. func (f *echo) Exec(args []interface{}, _ api.FunctionContext) (interface{}, bool) {
  15. result := args[0]
  16. return result, true
  17. }
  18. func (f *echo) IsAggregate() bool {
  19. return false
  20. }
  21. var Echo echo