(s *router.Context)
| 8 | ) |
| 9 | |
| 10 | func (r *Router) cmdPpub(s *router.Context) error { |
| 11 | args := s.Args |
| 12 | if len(args) != 3 { |
| 13 | return errors.New("ERR wrong number of arguments for 'ppub' command") |
| 14 | } |
| 15 | |
| 16 | var topicName, message string |
| 17 | |
| 18 | if args1Byte, ok := args[1].([]byte); ok { |
| 19 | topicName = string(args1Byte) |
| 20 | } else { |
| 21 | topicName = args[1].(string) |
| 22 | } |
| 23 | if args2Byte, ok := args[2].([]byte); ok { |
| 24 | message = string(args2Byte) |
| 25 | } else { |
| 26 | message = args[2].(string) |
| 27 | } |
| 28 | err := ppubsub.Pub(topicName, message) |
| 29 | if err != nil { |
| 30 | return errors.New("ERR pub:" + err.Error()) |
| 31 | } |
| 32 | return router.WriteSimpleString(s.Writer, "OK") |
| 33 | } |
| 34 | |
| 35 | func (r *Router) cmdPsub(s *router.Context) error { |
| 36 | args := s.Args |
nothing calls this directly
no test coverage detected