go-chat/message/message.go

33 lines
476 B
Go
Raw Normal View History

2021-04-22 06:12:35 +00:00
package message
import (
2021-04-25 01:53:49 +00:00
"chat/user"
2021-04-22 06:12:35 +00:00
"reflect"
)
var MsgType = map[string]reflect.Type{
"login_send": reflect.TypeOf(&LoginS{}).Elem(),
"login_response": reflect.TypeOf(&Correspond{}).Elem(),
2021-04-25 01:53:49 +00:00
"add_user": reflect.TypeOf(&user.User{}).Elem(),
2021-04-22 06:12:35 +00:00
}
type Message struct {
//Id int
Type string
2021-04-25 01:53:49 +00:00
Code int
Msg string
2021-04-22 06:12:35 +00:00
Data interface{}
}
type LoginS struct {
Uid int
Pw string
Name string
}
type Correspond struct {
Code int
Msg string
Error string
}