You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/pkg/common/db/model_struct.go

223 lines
8.9 KiB

3 years ago
package db
import "time"
3 years ago
type Register struct {
Account string `gorm:"column:account;primary_key;type:char(255)" json:"account"`
Password string `gorm:"column:password;type:varchar(255)" json:"password"`
Ex string `gorm:"column:ex;size:1024" json:"ex"`
}
3 years ago
//
//message FriendInfo{
//string OwnerUserID = 1;
//string Remark = 2;
//int64 CreateTime = 3;
//UserInfo FriendUser = 4;
//int32 AddSource = 5;
//string OperatorUserID = 6;
//string Ex = 7;
//}
//open_im_sdk.FriendInfo(FriendUser) != imdb.Friend(FriendUserID)
type Friend struct {
3 years ago
OwnerUserID string `gorm:"column:owner_user_id;primary_key;size:64"`
FriendUserID string `gorm:"column:friend_user_id;primary_key;size:64"`
Remark string `gorm:"column:remark;size:255"`
3 years ago
CreateTime time.Time `gorm:"column:create_time"`
AddSource int32 `gorm:"column:add_source"`
3 years ago
OperatorUserID string `gorm:"column:operator_user_id;size:64"`
Ex string `gorm:"column:ex;size:1024"`
}
3 years ago
3 years ago
//message FriendRequest{
//string FromUserID = 1;
//string ToUserID = 2;
//int32 HandleResult = 3;
//string ReqMsg = 4;
//int64 CreateTime = 5;
//string HandlerUserID = 6;
//string HandleMsg = 7;
//int64 HandleTime = 8;
//string Ex = 9;
//}
3 years ago
//open_im_sdk.FriendRequest(nickname, farce url ...) != imdb.FriendRequest
type FriendRequest struct {
3 years ago
FromUserID string `gorm:"column:from_user_id;primary_key;size:64"`
ToUserID string `gorm:"column:to_user_id;primary_key;size:64"`
3 years ago
HandleResult int32 `gorm:"column:handle_result"`
3 years ago
ReqMsg string `gorm:"column:req_msg;size:255"`
3 years ago
CreateTime time.Time `gorm:"column:create_time"`
3 years ago
HandlerUserID string `gorm:"column:handler_user_id;size:64"`
HandleMsg string `gorm:"column:handle_msg;size:255"`
3 years ago
HandleTime time.Time `gorm:"column:handle_time"`
3 years ago
Ex string `gorm:"column:ex;size:1024"`
}
3 years ago
3 years ago
func (FriendRequest) TableName() string {
return "friend_requests"
}
3 years ago
//message GroupInfo{
// string GroupID = 1;
// string GroupName = 2;
// string Notification = 3;
// string Introduction = 4;
// string FaceUrl = 5;
// string OwnerUserID = 6;
// uint32 MemberCount = 8;
// int64 CreateTime = 7;
// string Ex = 9;
// int32 Status = 10;
// string CreatorUserID = 11;
// int32 GroupType = 12;
//}
// open_im_sdk.GroupInfo (OwnerUserID , MemberCount )> imdb.Group
type Group struct {
3 years ago
//`json:"operationID" binding:"required"`
//`protobuf:"bytes,1,opt,name=GroupID" json:"GroupID,omitempty"` `json:"operationID" binding:"required"`
3 years ago
GroupID string `gorm:"column:group_id;primary_key;size:64" json:"groupID" binding:"required"`
GroupName string `gorm:"column:name;size:255" json:"groupName"`
Notification string `gorm:"column:notification;size:255" json:"notification"`
Introduction string `gorm:"column:introduction;size:255" json:"introduction"`
3 years ago
FaceURL string `gorm:"column:face_url;size:255" json:"faceURL"`
3 years ago
CreateTime time.Time `gorm:"column:create_time"`
3 years ago
Ex string `gorm:"column:ex" json:"ex;size:1024" json:"ex"`
3 years ago
Status int32 `gorm:"column:status"`
3 years ago
CreatorUserID string `gorm:"column:creator_user_id;size:64"`
3 years ago
GroupType int32 `gorm:"column:group_type"`
}
3 years ago
//message GroupMemberFullInfo {
//string GroupID = 1 ;
//string UserID = 2 ;
//int32 roleLevel = 3;
//int64 JoinTime = 4;
//string NickName = 5;
//string FaceUrl = 6;
//int32 JoinSource = 8;
//string OperatorUserID = 9;
//string Ex = 10;
//int32 AppMangerLevel = 7; //if >0
//} open_im_sdk.GroupMemberFullInfo(AppMangerLevel) > imdb.GroupMember
type GroupMember struct {
3 years ago
GroupID string `gorm:"column:group_id;primary_key;size:64"`
UserID string `gorm:"column:user_id;primary_key;size:64"`
Nickname string `gorm:"column:nickname;size:255"`
3 years ago
FaceURL string `gorm:"column:user_group_face_url;size:255"`
3 years ago
RoleLevel int32 `gorm:"column:role_level"`
JoinTime time.Time `gorm:"column:join_time"`
3 years ago
JoinSource int32 `gorm:"column:join_source"`
3 years ago
OperatorUserID string `gorm:"column:operator_user_id;size:64"`
Ex string `gorm:"column:ex;size:1024"`
3 years ago
}
3 years ago
//message GroupRequest{
//string UserID = 1;
//string GroupID = 2;
//string HandleResult = 3;
//string ReqMsg = 4;
//string HandleMsg = 5;
//int64 ReqTime = 6;
//string HandleUserID = 7;
//int64 HandleTime = 8;
//string Ex = 9;
//}open_im_sdk.GroupRequest == imdb.GroupRequest
3 years ago
type GroupRequest struct {
3 years ago
UserID string `gorm:"column:user_id;primary_key;size:64"`
GroupID string `gorm:"column:group_id;primary_key;size:64"`
3 years ago
HandleResult int32 `gorm:"column:handle_result"`
3 years ago
ReqMsg string `gorm:"column:req_msg;size:1024"`
HandledMsg string `gorm:"column:handle_msg;size:1024"`
3 years ago
ReqTime time.Time `gorm:"column:req_time"`
3 years ago
HandleUserID string `gorm:"column:handle_user_id;size:64"`
3 years ago
HandledTime time.Time `gorm:"column:handle_time"`
3 years ago
Ex string `gorm:"column:ex;size:1024"`
3 years ago
}
3 years ago
//string UserID = 1;
//string Nickname = 2;
//string FaceUrl = 3;
//int32 Gender = 4;
//string PhoneNumber = 5;
//string Birth = 6;
//string Email = 7;
//string Ex = 8;
//int64 CreateTime = 9;
//int32 AppMangerLevel = 10;
//open_im_sdk.User == imdb.User
3 years ago
type User struct {
3 years ago
UserID string `gorm:"column:user_id;primary_key;size:64"`
Nickname string `gorm:"column:name;size:255"`
3 years ago
FaceURL string `gorm:"column:face_url;size:255"`
3 years ago
Gender int32 `gorm:"column:gender"`
3 years ago
PhoneNumber string `gorm:"column:phone_number;size:32"`
3 years ago
Birth time.Time `gorm:"column:birth"`
3 years ago
Email string `gorm:"column:email;size:64"`
Ex string `gorm:"column:ex;size:1024"`
3 years ago
CreateTime time.Time `gorm:"column:create_time"`
AppMangerLevel int32 `gorm:"column:app_manger_level"`
3 years ago
}
3 years ago
//message BlackInfo{
//string OwnerUserID = 1;
//int64 CreateTime = 2;
//PublicUserInfo BlackUserInfo = 4;
//int32 AddSource = 5;
//string OperatorUserID = 6;
//string Ex = 7;
//}
// open_im_sdk.BlackInfo(BlackUserInfo) != imdb.Black (BlockUserID)
3 years ago
type Black struct {
3 years ago
OwnerUserID string `gorm:"column:owner_user_id;primary_key;size:64"`
BlockUserID string `gorm:"column:block_user_id;primary_key;size:64"`
3 years ago
CreateTime time.Time `gorm:"column:create_time"`
3 years ago
AddSource int32 `gorm:"column:add_source"`
3 years ago
OperatorUserID string `gorm:"column:operator_user_id;size:64"`
Ex string `gorm:"column:ex;size:1024"`
}
type ChatLog struct {
ServerMsgID string `gorm:"column:server_msg_id;primary_key;type:char(64)" json:"serverMsgID"`
ClientMsgID string `gorm:"column:client_msg_id;type:char(64)" json:"clientMsgID"`
SendID string `gorm:"column:send_id;type:char(64)" json:"sendID"`
RecvID string `gorm:"column:recv_id;type:char(64)" json:"recvID"`
SenderPlatformID int32 `gorm:"column:sender_platform_id" json:"senderPlatformID"`
SenderNickname string `gorm:"column:sender_nick_name;type:varchar(255)" json:"senderNickname"`
SenderFaceURL string `gorm:"column:sender_face_url;type:varchar(255)" json:"senderFaceURL"`
SessionType int32 `gorm:"column:session_type" json:"sessionType"`
MsgFrom int32 `gorm:"column:msg_from" json:"msgFrom"`
ContentType int32 `gorm:"column:content_type" json:"contentType"`
3 years ago
Content string `gorm:"column:content;type:varchar(3000)" json:"content"`
Status int32 `gorm:"column:status" json:"status"`
SendTime time.Time `gorm:"column:send_time" json:"sendTime"`
CreateTime time.Time `gorm:"column:create_time" json:"createTime"`
Ex string `gorm:"column:ex;type:varchar(1024)" json:"ex"`
}
3 years ago
3 years ago
func (ChatLog) TableName() string {
return "chat_logs"
}
3 years ago
type BlackList struct {
3 years ago
UserId string `gorm:"column:uid"`
3 years ago
BeginDisableTime time.Time `gorm:"column:begin_disable_time"`
3 years ago
EndDisableTime time.Time `gorm:"column:end_disable_time"`
}
3 years ago
type Conversation struct {
OwnerUserID string `gorm:"column:owner_user_id;primary_key;type:char(128)" json:"OwnerUserID"`
ConversationID string `gorm:"column:conversation_id;primary_key;type:char(128)" json:"conversationID"`
ConversationType int32 `gorm:"column:conversation_type" json:"conversationType"`
UserID string `gorm:"column:user_id;type:char(64)" json:"userID"`
GroupID string `gorm:"column:group_id;type:char(128)" json:"groupID"`
RecvMsgOpt int32 `gorm:"column:recv_msg_opt" json:"recvMsgOpt"`
UnreadCount int32 `gorm:"column:unread_count" json:"unreadCount"`
DraftTextTime int64 `gorm:"column:draft_text_time" json:"draftTextTime"`
IsPinned bool `gorm:"column:is_pinned" json:"isPinned"`
3 years ago
IsPrivateChat bool `gorm:"column:is_private_chat" json:"isPrivateChat"`
3 years ago
AttachedInfo string `gorm:"column:attached_info;type:varchar(1024)" json:"attachedInfo"`
Ex string `gorm:"column:ex;type:varchar(1024)" json:"ex"`
}
3 years ago
func (Conversation) TableName() string {
return "conversations"
}