[feat] 新增 ErrFuncNotImplemented

This commit is contained in:
what 2024-04-25 21:09:32 +08:00
parent aa401d6048
commit dd4fb6c049
2 changed files with 12 additions and 6 deletions

View File

@ -1,6 +1,10 @@
package contracts package contracts
import "github.com/samber/lo" import (
"errors"
"github.com/samber/lo"
)
// 定义错误码 // 定义错误码
type Errno struct { type Errno struct {
@ -24,6 +28,8 @@ func (err Err) Error() string {
return lo.Ternary(err.alert && err.Errord != "", err.Errord, err.Msg) return lo.Ternary(err.alert && err.Errord != "", err.Errord, err.Msg)
} }
var ErrFuncNotImplemented = errors.New("func not implemented")
// 错误码设计 // 错误码设计
// 第一位表示错误级别, 1 为系统错误, 2 为普通错误 // 第一位表示错误级别, 1 为系统错误, 2 为普通错误
// 第二三位表示服务模块代码 // 第二三位表示服务模块代码

10
mqtt.go
View File

@ -57,20 +57,20 @@ type MqttHandle struct {
Controller Controller
} }
func (this MqttHandle) OnSubscribed(g GlobalParams, topic string) error { func (this *MqttHandle) OnSubscribed(g GlobalParams, topic string) error {
return nil return ErrFuncNotImplemented
} }
func (this MqttHandle) OnUnsubscribed(g GlobalParams, topic string) error { 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 { 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 { func (this MqttHandle) OnMessageDropped(g GlobalParams, topic string, retain bool, qos byte) error {
return nil return ErrFuncNotImplemented
} }
func NewMqttController(container *do.Injector) Mqtt { func NewMqttController(container *do.Injector) Mqtt {