From dd4fb6c049b43d93982d913c4ea58cfd32b2999d Mon Sep 17 00:00:00 2001 From: what Date: Thu, 25 Apr 2024 21:09:32 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=20=E6=96=B0=E5=A2=9E=20ErrFuncNotImpleme?= =?UTF-8?q?nted?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- errno.go | 8 +++++++- mqtt.go | 10 +++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/errno.go b/errno.go index 11cbcaa..cbc7379 100644 --- a/errno.go +++ b/errno.go @@ -1,6 +1,10 @@ package contracts -import "github.com/samber/lo" +import ( + "errors" + + "github.com/samber/lo" +) // 定义错误码 type Errno struct { @@ -24,6 +28,8 @@ func (err Err) Error() string { return lo.Ternary(err.alert && err.Errord != "", err.Errord, err.Msg) } +var ErrFuncNotImplemented = errors.New("func not implemented") + // 错误码设计 // 第一位表示错误级别, 1 为系统错误, 2 为普通错误 // 第二三位表示服务模块代码 diff --git a/mqtt.go b/mqtt.go index d96e31d..e4f6652 100644 --- a/mqtt.go +++ b/mqtt.go @@ -57,20 +57,20 @@ type MqttHandle struct { Controller } -func (this MqttHandle) OnSubscribed(g GlobalParams, topic string) error { - return nil +func (this *MqttHandle) OnSubscribed(g GlobalParams, topic string) error { + return ErrFuncNotImplemented } func (this MqttHandle) OnUnsubscribed(g GlobalParams, topic string) error { - return nil + return ErrFuncNotImplemented } func (this MqttHandle) OnMessage(g GlobalParams, topic string, retain bool, qos byte) error { - return nil + return ErrFuncNotImplemented } func (this MqttHandle) OnMessageDropped(g GlobalParams, topic string, retain bool, qos byte) error { - return nil + return ErrFuncNotImplemented } func NewMqttController(container *do.Injector) Mqtt {