relation

package
v3.3.3-rc.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlackModelTableName = "blacks"
)
View Source
const (
	ChatLogModelTableName = "chat_logs"
)
View Source
const (
	FriendModelTableName = "friends"
)
View Source
const FriendRequestModelTableName = "friend_requests"
View Source
const (
	GroupMemberModelTableName = "group_members"
)
View Source
const (
	GroupModelTableName = "groups"
)
View Source
const (
	GroupRequestModelTableName = "group_requests"
)
View Source
const (
	ObjectInfoModelTableName = "object"
)
View Source
const (
	UserModelTableName = "users"
)

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

Types

type BatchUpdateGroupMember

type BatchUpdateGroupMember struct {
	GroupID string
	UserID  string
	Map     map[string]any
}

type BlackModel

type BlackModel struct {
	OwnerUserID    string    `gorm:"column:owner_user_id;primary_key;size:64"`
	BlockUserID    string    `gorm:"column:block_user_id;primary_key;size:64"`
	CreateTime     time.Time `gorm:"column:create_time"`
	AddSource      int32     `gorm:"column:add_source"`
	OperatorUserID string    `gorm:"column:operator_user_id;size:64"`
	Ex             string    `gorm:"column:ex;size:1024"`
}

func (BlackModel) TableName

func (BlackModel) TableName() string

type BlackModelInterface

type BlackModelInterface interface {
	Create(ctx context.Context, blacks []*BlackModel) (err error)
	Delete(ctx context.Context, blacks []*BlackModel) (err error)
	UpdateByMap(ctx context.Context, ownerUserID, blockUserID string, args map[string]interface{}) (err error)
	Update(ctx context.Context, blacks []*BlackModel) (err error)
	Find(ctx context.Context, blacks []*BlackModel) (blackList []*BlackModel, err error)
	Take(ctx context.Context, ownerUserID, blockUserID string) (black *BlackModel, err error)
	FindOwnerBlacks(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (blacks []*BlackModel, total int64, err error)
	FindOwnerBlackInfos(ctx context.Context, ownerUserID string, userIDs []string) (blacks []*BlackModel, err error)
	FindBlackUserIDs(ctx context.Context, ownerUserID string) (blackUserIDs []string, err error)
}

type ChatLogModel

type ChatLogModel struct {
	ServerMsgID      string    `` /* 167-byte string literal not displayed */
	ClientMsgID      string    `` /* 167-byte string literal not displayed */
	SendID           string    `` /* 162-byte string literal not displayed */
	RecvID           string    `` /* 162-byte string literal not displayed */
	SenderPlatformID int32     `` /* 172-byte string literal not displayed */
	SenderNickname   string    `` /* 170-byte string literal not displayed */
	SenderFaceURL    string    `` /* 169-byte string literal not displayed */
	SessionType      int32     `` /* 167-byte string literal not displayed */
	MsgFrom          int32     `` /* 163-byte string literal not displayed */
	ContentType      int32     `` /* 167-byte string literal not displayed */
	Content          string    `` /* 163-byte string literal not displayed */
	Status           int32     `` /* 162-byte string literal not displayed */
	SendTime         time.Time `` /* 164-byte string literal not displayed */
	CreateTime       time.Time `` /* 166-byte string literal not displayed */
	Ex               string    `` /* 158-byte string literal not displayed */
}

func (ChatLogModel) TableName

func (ChatLogModel) TableName() string

type ChatLogModelInterface

type ChatLogModelInterface interface {
	Create(msg *pbmsg.MsgDataToMQ) error
}

type ConversationModel

type ConversationModel 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"`
	IsPinned              bool      `gorm:"column:is_pinned"                                    json:"isPinned"`
	IsPrivateChat         bool      `gorm:"column:is_private_chat"                              json:"isPrivateChat"`
	BurnDuration          int32     `gorm:"column:burn_duration;default:30"                     json:"burnDuration"`
	GroupAtType           int32     `gorm:"column:group_at_type"                                json:"groupAtType"`
	AttachedInfo          string    `gorm:"column:attached_info;type:varchar(1024)"             json:"attachedInfo"`
	Ex                    string    `gorm:"column:ex;type:varchar(1024)"                        json:"ex"`
	MaxSeq                int64     `gorm:"column:max_seq"                                      json:"maxSeq"`
	MinSeq                int64     `gorm:"column:min_seq"                                      json:"minSeq"`
	CreateTime            time.Time `gorm:"column:create_time;index:create_time;autoCreateTime"`
	IsMsgDestruct         bool      `gorm:"column:is_msg_destruct;default:false"`
	MsgDestructTime       int64     `gorm:"column:msg_destruct_time;default:604800"`
	LatestMsgDestructTime time.Time `gorm:"column:latest_msg_destruct_time;autoCreateTime"`
}

func (ConversationModel) TableName

func (ConversationModel) TableName() string

type ConversationModelInterface

type ConversationModelInterface interface {
	Create(ctx context.Context, conversations []*ConversationModel) (err error)
	Delete(ctx context.Context, groupIDs []string) (err error)
	UpdateByMap(ctx context.Context, userIDs []string, conversationID string, args map[string]interface{}) (rows int64, err error)
	Update(ctx context.Context, conversation *ConversationModel) (err error)
	Find(ctx context.Context, ownerUserID string, conversationIDs []string) (conversations []*ConversationModel, err error)
	FindUserID(ctx context.Context, userIDs []string, conversationIDs []string) ([]string, error)
	FindUserIDAllConversationID(ctx context.Context, userID string) ([]string, error)
	Take(ctx context.Context, userID, conversationID string) (conversation *ConversationModel, err error)
	FindConversationID(ctx context.Context, userID string, conversationIDs []string) (existConversationID []string, err error)
	FindUserIDAllConversations(ctx context.Context, userID string) (conversations []*ConversationModel, err error)
	FindRecvMsgNotNotifyUserIDs(ctx context.Context, groupID string) ([]string, error)
	GetUserRecvMsgOpt(ctx context.Context, ownerUserID, conversationID string) (opt int, err error)
	FindSuperGroupRecvMsgNotNotifyUserIDs(ctx context.Context, groupID string) ([]string, error)
	GetAllConversationIDs(ctx context.Context) ([]string, error)
	GetUserAllHasReadSeqs(ctx context.Context, ownerUserID string) (hashReadSeqs map[string]int64, err error)
	GetConversationsByConversationID(ctx context.Context, conversationIDs []string) ([]*ConversationModel, error)
	GetConversationIDsNeedDestruct(ctx context.Context) ([]*ConversationModel, error)
	GetConversationNotReceiveMessageUserIDs(ctx context.Context, conversationID string) ([]string, error)
	NewTx(tx any) ConversationModelInterface
}

type FriendModel

type FriendModel struct {
	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"`
	CreateTime     time.Time `gorm:"column:create_time;autoCreateTime"`
	AddSource      int32     `gorm:"column:add_source"`
	OperatorUserID string    `gorm:"column:operator_user_id;size:64"`
	Ex             string    `gorm:"column:ex;size:1024"`
}

func (FriendModel) TableName

func (FriendModel) TableName() string

type FriendModelInterface

type FriendModelInterface interface {
	// 插入多条记录
	Create(ctx context.Context, friends []*FriendModel) (err error)
	// 删除ownerUserID指定的好友
	Delete(ctx context.Context, ownerUserID string, friendUserIDs []string) (err error)
	// 更新ownerUserID单个好友信息 更新零值
	UpdateByMap(ctx context.Context, ownerUserID string, friendUserID string, args map[string]interface{}) (err error)
	// 更新好友信息的非零值
	Update(ctx context.Context, friends []*FriendModel) (err error)
	// 更新好友备注(也支持零值 )
	UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string) (err error)
	// 获取单个好友信息,如没找到 返回错误
	Take(ctx context.Context, ownerUserID, friendUserID string) (friend *FriendModel, err error)
	// 查找好友关系,如果是双向关系,则都返回
	FindUserState(ctx context.Context, userID1, userID2 string) (friends []*FriendModel, err error)
	// 获取 owner指定的好友列表 如果有friendUserIDs不存在,也不返回错误
	FindFriends(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*FriendModel, err error)
	// 获取哪些人添加了friendUserID 如果有ownerUserIDs不存在,也不返回错误
	FindReversalFriends(
		ctx context.Context,
		friendUserID string,
		ownerUserIDs []string,
	) (friends []*FriendModel, err error)
	// 获取ownerUserID好友列表 支持翻页
	FindOwnerFriends(
		ctx context.Context,
		ownerUserID string,
		pageNumber, showNumber int32,
	) (friends []*FriendModel, total int64, err error)
	// 获取哪些人添加了friendUserID 支持翻页
	FindInWhoseFriends(
		ctx context.Context,
		friendUserID string,
		pageNumber, showNumber int32,
	) (friends []*FriendModel, total int64, err error)
	// 获取好友UserID列表
	FindFriendUserIDs(ctx context.Context, ownerUserID string) (friendUserIDs []string, err error)
	NewTx(tx any) FriendModelInterface
}

type FriendRequestModel

type FriendRequestModel struct {
	FromUserID    string    `gorm:"column:from_user_id;primary_key;size:64"`
	ToUserID      string    `gorm:"column:to_user_id;primary_key;size:64"`
	HandleResult  int32     `gorm:"column:handle_result"`
	ReqMsg        string    `gorm:"column:req_msg;size:255"`
	CreateTime    time.Time `gorm:"column:create_time; autoCreateTime"`
	HandlerUserID string    `gorm:"column:handler_user_id;size:64"`
	HandleMsg     string    `gorm:"column:handle_msg;size:255"`
	HandleTime    time.Time `gorm:"column:handle_time"`
	Ex            string    `gorm:"column:ex;size:1024"`
}

func (FriendRequestModel) TableName

func (FriendRequestModel) TableName() string

type FriendRequestModelInterface

type FriendRequestModelInterface interface {
	// 插入多条记录
	Create(ctx context.Context, friendRequests []*FriendRequestModel) (err error)
	// 删除记录
	Delete(ctx context.Context, fromUserID, toUserID string) (err error)
	// 更新零值
	UpdateByMap(ctx context.Context, formUserID string, toUserID string, args map[string]interface{}) (err error)
	// 更新多条记录 (非零值)
	Update(ctx context.Context, friendRequest *FriendRequestModel) (err error)
	// 获取来指定用户的好友申请  未找到 不返回错误
	Find(ctx context.Context, fromUserID, toUserID string) (friendRequest *FriendRequestModel, err error)
	Take(ctx context.Context, fromUserID, toUserID string) (friendRequest *FriendRequestModel, err error)
	// 获取toUserID收到的好友申请列表
	FindToUserID(
		ctx context.Context,
		toUserID string,
		pageNumber, showNumber int32,
	) (friendRequests []*FriendRequestModel, total int64, err error)
	// 获取fromUserID发出去的好友申请列表
	FindFromUserID(
		ctx context.Context,
		fromUserID string,
		pageNumber, showNumber int32,
	) (friendRequests []*FriendRequestModel, total int64, err error)
	FindBothFriendRequests(ctx context.Context, fromUserID, toUserID string) (friends []*FriendRequestModel, err error)
	NewTx(tx any) FriendRequestModelInterface
}

type GroupMemberModel

type GroupMemberModel struct {
	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"`
	FaceURL        string    `gorm:"column:user_group_face_url;size:255"`
	RoleLevel      int32     `gorm:"column:role_level"`
	JoinTime       time.Time `gorm:"column:join_time"`
	JoinSource     int32     `gorm:"column:join_source"`
	InviterUserID  string    `gorm:"column:inviter_user_id;size:64"`
	OperatorUserID string    `gorm:"column:operator_user_id;size:64"`
	MuteEndTime    time.Time `gorm:"column:mute_end_time"`
	Ex             string    `gorm:"column:ex;size:1024"`
}

func (GroupMemberModel) TableName

func (GroupMemberModel) TableName() string

type GroupMemberModelInterface

type GroupMemberModelInterface interface {
	NewTx(tx any) GroupMemberModelInterface
	Create(ctx context.Context, groupMembers []*GroupMemberModel) (err error)
	Delete(ctx context.Context, groupID string, userIDs []string) (err error)
	DeleteGroup(ctx context.Context, groupIDs []string) (err error)
	Update(ctx context.Context, groupID string, userID string, data map[string]any) (err error)
	UpdateRoleLevel(ctx context.Context, groupID string, userID string, roleLevel int32) (rowsAffected int64, err error)
	Find(
		ctx context.Context,
		groupIDs []string,
		userIDs []string,
		roleLevels []int32,
	) (groupMembers []*GroupMemberModel, err error)
	FindMemberUserID(ctx context.Context, groupID string) (userIDs []string, err error)
	Take(ctx context.Context, groupID string, userID string) (groupMember *GroupMemberModel, err error)
	TakeOwner(ctx context.Context, groupID string) (groupMember *GroupMemberModel, err error)
	SearchMember(
		ctx context.Context,
		keyword string,
		groupIDs []string,
		userIDs []string,
		roleLevels []int32,
		pageNumber, showNumber int32,
	) (total uint32, groupList []*GroupMemberModel, err error)
	MapGroupMemberNum(ctx context.Context, groupIDs []string) (count map[string]uint32, err error)
	FindJoinUserID(ctx context.Context, groupIDs []string) (groupUsers map[string][]string, err error)
	FindUserJoinedGroupID(ctx context.Context, userID string) (groupIDs []string, err error)
	TakeGroupMemberNum(ctx context.Context, groupID string) (count int64, err error)
	FindUsersJoinedGroupID(ctx context.Context, userIDs []string) (map[string][]string, error)
	FindUserManagedGroupID(ctx context.Context, userID string) (groupIDs []string, err error)
}

type GroupModel

type GroupModel struct {
	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"`
	FaceURL                string    `gorm:"column:face_url;size:255"                            json:"faceURL"`
	CreateTime             time.Time `gorm:"column:create_time;index:create_time;autoCreateTime"`
	Ex                     string    `gorm:"column:ex"                                           json:"ex;size:1024"`
	Status                 int32     `gorm:"column:status"`
	CreatorUserID          string    `gorm:"column:creator_user_id;size:64"`
	GroupType              int32     `gorm:"column:group_type"`
	NeedVerification       int32     `gorm:"column:need_verification"`
	LookMemberInfo         int32     `gorm:"column:look_member_info"                             json:"lookMemberInfo"`
	ApplyMemberFriend      int32     `gorm:"column:apply_member_friend"                          json:"applyMemberFriend"`
	NotificationUpdateTime time.Time `gorm:"column:notification_update_time"`
	NotificationUserID     string    `gorm:"column:notification_user_id;size:64"`
}

func (GroupModel) TableName

func (GroupModel) TableName() string

type GroupModelInterface

type GroupModelInterface interface {
	NewTx(tx any) GroupModelInterface
	Create(ctx context.Context, groups []*GroupModel) (err error)
	UpdateMap(ctx context.Context, groupID string, args map[string]interface{}) (err error)
	UpdateStatus(ctx context.Context, groupID string, status int32) (err error)
	Find(ctx context.Context, groupIDs []string) (groups []*GroupModel, err error)
	FindNotDismissedGroup(ctx context.Context, groupIDs []string) (groups []*GroupModel, err error)
	Take(ctx context.Context, groupID string) (group *GroupModel, err error)
	Search(
		ctx context.Context,
		keyword string,
		pageNumber, showNumber int32,
	) (total uint32, groups []*GroupModel, err error)
	GetGroupIDsByGroupType(ctx context.Context, groupType int) (groupIDs []string, err error)
	// 获取群总数
	CountTotal(ctx context.Context, before *time.Time) (count int64, err error)
	// 获取范围内群增量
	CountRangeEverydayTotal(ctx context.Context, start time.Time, end time.Time) (map[string]int64, error)
}

type GroupRequestModel

type GroupRequestModel struct {
	UserID        string    `gorm:"column:user_id;primary_key;size:64"`
	GroupID       string    `gorm:"column:group_id;primary_key;size:64"`
	HandleResult  int32     `gorm:"column:handle_result"`
	ReqMsg        string    `gorm:"column:req_msg;size:1024"`
	HandledMsg    string    `gorm:"column:handle_msg;size:1024"`
	ReqTime       time.Time `gorm:"column:req_time"`
	HandleUserID  string    `gorm:"column:handle_user_id;size:64"`
	HandledTime   time.Time `gorm:"column:handle_time"`
	JoinSource    int32     `gorm:"column:join_source"`
	InviterUserID string    `gorm:"column:inviter_user_id;size:64"`
	Ex            string    `gorm:"column:ex;size:1024"`
}

func (GroupRequestModel) TableName

func (GroupRequestModel) TableName() string

type GroupRequestModelInterface

type GroupRequestModelInterface interface {
	NewTx(tx any) GroupRequestModelInterface
	Create(ctx context.Context, groupRequests []*GroupRequestModel) (err error)
	Delete(ctx context.Context, groupID string, userID string) (err error)
	UpdateHandler(ctx context.Context, groupID string, userID string, handledMsg string, handleResult int32) (err error)
	Take(ctx context.Context, groupID string, userID string) (groupRequest *GroupRequestModel, err error)
	FindGroupRequests(ctx context.Context, groupID string, userIDs []string) (int64, []*GroupRequestModel, error)
	Page(
		ctx context.Context,
		userID string,
		pageNumber, showNumber int32,
	) (total uint32, groups []*GroupRequestModel, err error)
	PageGroup(
		ctx context.Context,
		groupIDs []string,
		pageNumber, showNumber int32,
	) (total uint32, groups []*GroupRequestModel, err error)
}

type GroupSimpleUserID

type GroupSimpleUserID struct {
	Hash      uint64
	MemberNum uint32
}

type Log added in v3.3.2

type Log struct {
	LogID      string    `gorm:"column:log_id;primary_key;type:char(64)"`
	Platform   string    `gorm:"column:platform;type:varchar(32)"`
	UserID     string    `gorm:"column:user_id;type:char(64)"`
	CreateTime time.Time `gorm:"index:,sort:desc"`
	Url        string    `gorm:"column:url;type varchar(255)"`
	FileName   string    `gorm:"column:filename;type varchar(255)"`
	SystemType string    `gorm:"column:system_type;type varchar(255)"`
	Version    string    `gorm:"column:version;type varchar(255)"`
	Ex         string    `gorm:"column:ex;type varchar(255)"`
}

type LogInterface added in v3.3.2

type LogInterface interface {
	Create(ctx context.Context, log []*Log) error
	Search(ctx context.Context, keyword string, start time.Time, end time.Time, pageNumber int32, showNumber int32) (uint32, []*Log, error)
	Delete(ctx context.Context, logID []string, userID string) error
	Get(ctx context.Context, logIDs []string, userID string) ([]*Log, error)
}

type ObjectInfoModelInterface

type ObjectInfoModelInterface interface {
	NewTx(tx any) ObjectInfoModelInterface
	SetObject(ctx context.Context, obj *ObjectModel) error
	Take(ctx context.Context, name string) (*ObjectModel, error)
}

type ObjectModel

type ObjectModel struct {
	Name        string    `gorm:"column:name;primary_key"`
	UserID      string    `gorm:"column:user_id"`
	Hash        string    `gorm:"column:hash"`
	Key         string    `gorm:"column:key"`
	Size        int64     `gorm:"column:size"`
	ContentType string    `gorm:"column:content_type"`
	Cause       string    `gorm:"column:cause"`
	CreateTime  time.Time `gorm:"column:create_time"`
}

func (ObjectModel) TableName

func (ObjectModel) TableName() string

type UserModel

type UserModel struct {
	UserID           string    `gorm:"column:user_id;primary_key;size:64"`
	Nickname         string    `gorm:"column:name;size:255"`
	FaceURL          string    `gorm:"column:face_url;size:255"`
	Ex               string    `gorm:"column:ex;size:1024"`
	CreateTime       time.Time `gorm:"column:create_time;index:create_time;autoCreateTime"`
	AppMangerLevel   int32     `gorm:"column:app_manger_level;default:1"`
	GlobalRecvMsgOpt int32     `gorm:"column:global_recv_msg_opt"`
}

func (*UserModel) GetEx

func (u *UserModel) GetEx() string

func (*UserModel) GetFaceURL

func (u *UserModel) GetFaceURL() string

func (*UserModel) GetNickname

func (u *UserModel) GetNickname() string

func (*UserModel) GetUserID

func (u *UserModel) GetUserID() string

func (UserModel) TableName

func (UserModel) TableName() string

type UserModelInterface

type UserModelInterface interface {
	Create(ctx context.Context, users []*UserModel) (err error)
	UpdateByMap(ctx context.Context, userID string, args map[string]interface{}) (err error)
	Update(ctx context.Context, user *UserModel) (err error)
	// 获取指定用户信息  不存在,也不返回错误
	Find(ctx context.Context, userIDs []string) (users []*UserModel, err error)
	// 获取某个用户信息  不存在,则返回错误
	Take(ctx context.Context, userID string) (user *UserModel, err error)
	// 获取用户信息 不存在,不返回错误
	Page(ctx context.Context, pageNumber, showNumber int32) (users []*UserModel, count int64, err error)
	GetAllUserID(ctx context.Context, pageNumber, showNumber int32) (userIDs []string, err error)
	GetUserGlobalRecvMsgOpt(ctx context.Context, userID string) (opt int, err error)
	// 获取用户总数
	CountTotal(ctx context.Context, before *time.Time) (count int64, err error)
	// 获取范围内用户增量
	CountRangeEverydayTotal(ctx context.Context, start time.Time, end time.Time) (map[string]int64, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL