Browse Source

[🚀] interface{} to any

bvbej 1 year ago
parent
commit
d822beb4ae

+ 1 - 1
pkg/database/tool.go

@@ -11,7 +11,7 @@ import (
 
 type NullTime sql.NullTime
 
-func (n *NullTime) Scan(value interface{}) error {
+func (n *NullTime) Scan(value any) error {
 	return (*sql.NullTime)(n).Scan(value)
 }
 

+ 1 - 1
pkg/websocket/client/client.go

@@ -60,7 +60,7 @@ type client struct {
 	onReconnect   func()
 }
 
-func New(logger *zap.Logger, url url.URL, decoder string, handlers interface{}) (Client, error) {
+func New(logger *zap.Logger, url url.URL, decoder string, handlers any) (Client, error) {
 	if !tool.InArray(url.Scheme, []string{"ws", "wss"}) {
 		return nil, errors.New(`param: scheme not supported`)
 	}

+ 1 - 1
pkg/websocket/client/service/receiver.go

@@ -15,7 +15,7 @@ type Handler struct {
 	IsRawArg bool           // 数据是否需要序列化
 }
 
-func RegisterHandler(components ...interface{}) map[string]*Handler {
+func RegisterHandler(components ...any) map[string]*Handler {
 	methods := make(map[string]*Handler)
 	for _, component := range components {
 		rt := reflect.TypeOf(component)

+ 5 - 5
pkg/websocket/codec/protobuf/protocol/base.pb.go

@@ -20,7 +20,7 @@ const (
 	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
 )
 
-//通信包装
+// 通信包装
 type TransPack struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -84,7 +84,7 @@ func (x *TransPack) GetError() string {
 	return ""
 }
 
-//连接检测
+// 连接检测
 type PingPang struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -162,7 +162,7 @@ func file_base_proto_rawDescGZIP() []byte {
 }
 
 var file_base_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
-var file_base_proto_goTypes = []interface{}{
+var file_base_proto_goTypes = []any{
 	(*TransPack)(nil), // 0: protocol.TransPack
 	(*PingPang)(nil),  // 1: protocol.PingPang
 }
@@ -180,7 +180,7 @@ func file_base_proto_init() {
 		return
 	}
 	if !protoimpl.UnsafeEnabled {
-		file_base_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+		file_base_proto_msgTypes[0].Exporter = func(v any, i int) any {
 			switch v := v.(*TransPack); i {
 			case 0:
 				return &v.state
@@ -192,7 +192,7 @@ func file_base_proto_init() {
 				return nil
 			}
 		}
-		file_base_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+		file_base_proto_msgTypes[1].Exporter = func(v any, i int) any {
 			switch v := v.(*PingPang); i {
 			case 0:
 				return &v.state

+ 1 - 1
pkg/websocket/service/service_manager.go

@@ -17,7 +17,7 @@ var (
 
 const ChildName = "Hbase"
 
-type Hbase interface{}
+type Hbase any
 
 func RegisterService(logger *zap.Logger, comp ...Component) {
 	serviceLogger = logger