mgo

package
v0.0.0-...-d9cd954 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBlackMongo

func NewBlackMongo(db *mongo.Database) (relation.BlackModelInterface, error)

func NewFriendMongo

func NewFriendMongo(db *mongo.Database) (relation.FriendModelInterface, error)

NewFriendMongo creates a new instance of FriendMgo with the provided MongoDB database.

func NewGroupMongo

func NewGroupMongo(db *mongo.Database) (relation.GroupModelInterface, error)

func NewLogMongo

func NewLogMongo(db *mongo.Database) (relation.LogInterface, error)

func NewUserMongo

func NewUserMongo(db *mongo.Database) (relation.UserModelInterface, error)

Types

type BlackMgo

type BlackMgo struct {
	// contains filtered or unexported fields
}

func (*BlackMgo) Create

func (b *BlackMgo) Create(ctx context.Context, blacks []*relation.BlackModel) (err error)

func (*BlackMgo) Delete

func (b *BlackMgo) Delete(ctx context.Context, blacks []*relation.BlackModel) (err error)

func (*BlackMgo) Find

func (b *BlackMgo) Find(ctx context.Context, blacks []*relation.BlackModel) (blackList []*relation.BlackModel, err error)

func (*BlackMgo) FindBlackUserIDs

func (b *BlackMgo) FindBlackUserIDs(ctx context.Context, ownerUserID string) (blackUserIDs []string, err error)

func (*BlackMgo) FindOwnerBlackInfos

func (b *BlackMgo) FindOwnerBlackInfos(ctx context.Context, ownerUserID string, userIDs []string) (blacks []*relation.BlackModel, err error)

func (*BlackMgo) FindOwnerBlacks

func (b *BlackMgo) FindOwnerBlacks(ctx context.Context, ownerUserID string, pagination pagination.Pagination) (total int64, blacks []*relation.BlackModel, err error)

func (*BlackMgo) Take

func (b *BlackMgo) Take(ctx context.Context, ownerUserID, blockUserID string) (black *relation.BlackModel, err error)

func (*BlackMgo) UpdateByMap

func (b *BlackMgo) UpdateByMap(ctx context.Context, ownerUserID, blockUserID string, args map[string]any) (err error)

type ConversationMgo

type ConversationMgo struct {
	// contains filtered or unexported fields
}

func NewConversationMongo

func NewConversationMongo(db *mongo.Database) (*ConversationMgo, error)

func (*ConversationMgo) Create

func (c *ConversationMgo) Create(ctx context.Context, conversations []*relation.ConversationModel) (err error)

func (*ConversationMgo) Delete

func (c *ConversationMgo) Delete(ctx context.Context, groupIDs []string) (err error)

func (*ConversationMgo) Find

func (c *ConversationMgo) Find(ctx context.Context, ownerUserID string, conversationIDs []string) (conversations []*relation.ConversationModel, err error)

func (*ConversationMgo) FindConversationID

func (c *ConversationMgo) FindConversationID(ctx context.Context, userID string, conversationIDs []string) (existConversationID []string, err error)

func (*ConversationMgo) FindRecvMsgUserIDs

func (c *ConversationMgo) FindRecvMsgUserIDs(ctx context.Context, conversationID string, recvOpts []int) ([]string, error)

func (*ConversationMgo) FindUserID

func (c *ConversationMgo) FindUserID(ctx context.Context, userIDs []string, conversationIDs []string) ([]string, error)

func (*ConversationMgo) FindUserIDAllConversationID

func (c *ConversationMgo) FindUserIDAllConversationID(ctx context.Context, userID string) ([]string, error)

func (*ConversationMgo) FindUserIDAllConversations

func (c *ConversationMgo) FindUserIDAllConversations(ctx context.Context, userID string) (conversations []*relation.ConversationModel, err error)

func (*ConversationMgo) GetAllConversationIDs

func (c *ConversationMgo) GetAllConversationIDs(ctx context.Context) ([]string, error)

func (*ConversationMgo) GetAllConversationIDsNumber

func (c *ConversationMgo) GetAllConversationIDsNumber(ctx context.Context) (int64, error)

func (*ConversationMgo) GetConversationIDsNeedDestruct

func (c *ConversationMgo) GetConversationIDsNeedDestruct(ctx context.Context) ([]*relation.ConversationModel, error)

func (*ConversationMgo) GetConversationNotReceiveMessageUserIDs

func (c *ConversationMgo) GetConversationNotReceiveMessageUserIDs(ctx context.Context, conversationID string) ([]string, error)

func (*ConversationMgo) GetConversationsByConversationID

func (c *ConversationMgo) GetConversationsByConversationID(ctx context.Context, conversationIDs []string) ([]*relation.ConversationModel, error)

func (*ConversationMgo) GetUserRecvMsgOpt

func (c *ConversationMgo) GetUserRecvMsgOpt(ctx context.Context, ownerUserID, conversationID string) (opt int, err error)

func (*ConversationMgo) PageConversationIDs

func (c *ConversationMgo) PageConversationIDs(ctx context.Context, pagination pagination.Pagination) (conversationIDs []string, err error)

func (*ConversationMgo) Take

func (c *ConversationMgo) Take(ctx context.Context, userID, conversationID string) (conversation *relation.ConversationModel, err error)

func (*ConversationMgo) Update

func (c *ConversationMgo) Update(ctx context.Context, conversation *relation.ConversationModel) (err error)

func (*ConversationMgo) UpdateByMap

func (c *ConversationMgo) UpdateByMap(ctx context.Context, userIDs []string, conversationID string, args map[string]any) (rows int64, err error)

type FriendMgo

type FriendMgo struct {
	// contains filtered or unexported fields
}

FriendMgo implements FriendModelInterface using MongoDB as the storage backend.

func (*FriendMgo) Create

func (f *FriendMgo) Create(ctx context.Context, friends []*relation.FriendModel) error

Create inserts multiple friend records.

func (*FriendMgo) Delete

func (f *FriendMgo) Delete(ctx context.Context, ownerUserID string, friendUserIDs []string) error

Delete removes specified friends of the owner user.

func (*FriendMgo) FindFriendUserIDs

func (f *FriendMgo) FindFriendUserIDs(ctx context.Context, ownerUserID string) ([]string, error)

FindFriendUserIDs retrieves a list of friend user IDs for a given owner.

func (*FriendMgo) FindFriends

func (f *FriendMgo) FindFriends(ctx context.Context, ownerUserID string, friendUserIDs []string) ([]*relation.FriendModel, error)

FindFriends retrieves a list of friends for a given owner. Missing friends do not cause an error.

func (*FriendMgo) FindInWhoseFriends

func (f *FriendMgo) FindInWhoseFriends(ctx context.Context, friendUserID string, pagination pagination.Pagination) (int64, []*relation.FriendModel, error)

FindInWhoseFriends finds users who have added the specified user as a friend, with pagination.

func (*FriendMgo) FindOwnerFriends

func (f *FriendMgo) FindOwnerFriends(ctx context.Context, ownerUserID string, pagination pagination.Pagination) (int64, []*relation.FriendModel, error)

FindOwnerFriends retrieves a paginated list of friends for a given owner.

func (*FriendMgo) FindReversalFriends

func (f *FriendMgo) FindReversalFriends(ctx context.Context, friendUserID string, ownerUserIDs []string) ([]*relation.FriendModel, error)

FindReversalFriends finds users who have added the specified user as a friend.

func (*FriendMgo) FindUserState

func (f *FriendMgo) FindUserState(ctx context.Context, userID1, userID2 string) ([]*relation.FriendModel, error)

FindUserState finds the friendship status between two users.

func (*FriendMgo) Take

func (f *FriendMgo) Take(ctx context.Context, ownerUserID, friendUserID string) (*relation.FriendModel, error)

Take retrieves a single friend document. Returns an error if not found.

func (*FriendMgo) UpdateByMap

func (f *FriendMgo) UpdateByMap(ctx context.Context, ownerUserID string, friendUserID string, args map[string]interface{}) error

UpdateByMap updates specific fields of a friend document using a map.

func (*FriendMgo) UpdateFriends

func (f *FriendMgo) UpdateFriends(ctx context.Context, ownerUserID string, friendUserIDs []string, val map[string]any) error

func (*FriendMgo) UpdateRemark

func (f *FriendMgo) UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string) error

UpdateRemark updates the remark for a specific friend.

type FriendRequestMgo

type FriendRequestMgo struct {
	// contains filtered or unexported fields
}

func (*FriendRequestMgo) Create

func (f *FriendRequestMgo) Create(ctx context.Context, friendRequests []*relation.FriendRequestModel) error

func (*FriendRequestMgo) Delete

func (f *FriendRequestMgo) Delete(ctx context.Context, fromUserID, toUserID string) (err error)

func (*FriendRequestMgo) Find

func (f *FriendRequestMgo) Find(ctx context.Context, fromUserID, toUserID string) (friendRequest *relation.FriendRequestModel, err error)

func (*FriendRequestMgo) FindBothFriendRequests

func (f *FriendRequestMgo) FindBothFriendRequests(ctx context.Context, fromUserID, toUserID string) (friends []*relation.FriendRequestModel, err error)

func (*FriendRequestMgo) FindFromUserID

func (f *FriendRequestMgo) FindFromUserID(ctx context.Context, fromUserID string, pagination pagination.Pagination) (total int64, friendRequests []*relation.FriendRequestModel, err error)

func (*FriendRequestMgo) FindToUserID

func (f *FriendRequestMgo) FindToUserID(ctx context.Context, toUserID string, pagination pagination.Pagination) (total int64, friendRequests []*relation.FriendRequestModel, err error)

func (*FriendRequestMgo) Take

func (f *FriendRequestMgo) Take(ctx context.Context, fromUserID, toUserID string) (friendRequest *relation.FriendRequestModel, err error)

func (*FriendRequestMgo) Update

func (f *FriendRequestMgo) Update(ctx context.Context, friendRequest *relation.FriendRequestModel) (err error)

func (*FriendRequestMgo) UpdateByMap

func (f *FriendRequestMgo) UpdateByMap(ctx context.Context, formUserID, toUserID string, args map[string]any) (err error)

type GroupMemberMgo

type GroupMemberMgo struct {
	// contains filtered or unexported fields
}

func (*GroupMemberMgo) Create

func (g *GroupMemberMgo) Create(ctx context.Context, groupMembers []*relation.GroupMemberModel) (err error)

func (*GroupMemberMgo) Delete

func (g *GroupMemberMgo) Delete(ctx context.Context, groupID string, userIDs []string) (err error)

func (*GroupMemberMgo) Find

func (g *GroupMemberMgo) Find(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32) (groupMembers []*relation.GroupMemberModel, err error)

func (*GroupMemberMgo) FindMemberUserID

func (g *GroupMemberMgo) FindMemberUserID(ctx context.Context, groupID string) (userIDs []string, err error)

func (*GroupMemberMgo) FindRoleLevelUserIDs

func (g *GroupMemberMgo) FindRoleLevelUserIDs(ctx context.Context, groupID string, roleLevel int32) ([]string, error)

func (*GroupMemberMgo) FindUserJoinedGroupID

func (g *GroupMemberMgo) FindUserJoinedGroupID(ctx context.Context, userID string) (groupIDs []string, err error)

func (*GroupMemberMgo) FindUserManagedGroupID

func (g *GroupMemberMgo) FindUserManagedGroupID(ctx context.Context, userID string) (groupIDs []string, err error)

func (*GroupMemberMgo) IsUpdateRoleLevel

func (g *GroupMemberMgo) IsUpdateRoleLevel(data map[string]any) bool

func (*GroupMemberMgo) SearchMember

func (g *GroupMemberMgo) SearchMember(ctx context.Context, keyword string, groupID string, pagination pagination.Pagination) (total int64, groupList []*relation.GroupMemberModel, err error)

func (*GroupMemberMgo) Take

func (g *GroupMemberMgo) Take(ctx context.Context, groupID string, userID string) (groupMember *relation.GroupMemberModel, err error)

func (*GroupMemberMgo) TakeGroupMemberNum

func (g *GroupMemberMgo) TakeGroupMemberNum(ctx context.Context, groupID string) (count int64, err error)

func (*GroupMemberMgo) TakeOwner

func (g *GroupMemberMgo) TakeOwner(ctx context.Context, groupID string) (groupMember *relation.GroupMemberModel, err error)

func (*GroupMemberMgo) Update

func (g *GroupMemberMgo) Update(ctx context.Context, groupID string, userID string, data map[string]any) (err error)

func (*GroupMemberMgo) UpdateRoleLevel

func (g *GroupMemberMgo) UpdateRoleLevel(ctx context.Context, groupID string, userID string, roleLevel int32) error

type GroupMgo

type GroupMgo struct {
	// contains filtered or unexported fields
}

func (*GroupMgo) CountRangeEverydayTotal

func (g *GroupMgo) CountRangeEverydayTotal(ctx context.Context, start time.Time, end time.Time) (map[string]int64, error)

func (*GroupMgo) CountTotal

func (g *GroupMgo) CountTotal(ctx context.Context, before *time.Time) (count int64, err error)

func (*GroupMgo) Create

func (g *GroupMgo) Create(ctx context.Context, groups []*relation.GroupModel) (err error)

func (*GroupMgo) Find

func (g *GroupMgo) Find(ctx context.Context, groupIDs []string) (groups []*relation.GroupModel, err error)

func (*GroupMgo) Search

func (g *GroupMgo) Search(ctx context.Context, keyword string, pagination pagination.Pagination) (total int64, groups []*relation.GroupModel, err error)

func (*GroupMgo) Take

func (g *GroupMgo) Take(ctx context.Context, groupID string) (group *relation.GroupModel, err error)

func (*GroupMgo) UpdateMap

func (g *GroupMgo) UpdateMap(ctx context.Context, groupID string, args map[string]any) (err error)

func (*GroupMgo) UpdateStatus

func (g *GroupMgo) UpdateStatus(ctx context.Context, groupID string, status int32) (err error)

type GroupRequestMgo

type GroupRequestMgo struct {
	// contains filtered or unexported fields
}

func (*GroupRequestMgo) Create

func (g *GroupRequestMgo) Create(ctx context.Context, groupRequests []*relation.GroupRequestModel) (err error)

func (*GroupRequestMgo) Delete

func (g *GroupRequestMgo) Delete(ctx context.Context, groupID string, userID string) (err error)

func (*GroupRequestMgo) FindGroupRequests

func (g *GroupRequestMgo) FindGroupRequests(ctx context.Context, groupID string, userIDs []string) ([]*relation.GroupRequestModel, error)

func (*GroupRequestMgo) Page

func (g *GroupRequestMgo) Page(ctx context.Context, userID string, pagination pagination.Pagination) (total int64, groups []*relation.GroupRequestModel, err error)

func (*GroupRequestMgo) PageGroup

func (g *GroupRequestMgo) PageGroup(ctx context.Context, groupIDs []string, pagination pagination.Pagination) (total int64, groups []*relation.GroupRequestModel, err error)

func (*GroupRequestMgo) Take

func (g *GroupRequestMgo) Take(ctx context.Context, groupID string, userID string) (groupRequest *relation.GroupRequestModel, err error)

func (*GroupRequestMgo) UpdateHandler

func (g *GroupRequestMgo) UpdateHandler(ctx context.Context, groupID string, userID string, handledMsg string, handleResult int32) (err error)

type LogMgo

type LogMgo struct {
	// contains filtered or unexported fields
}

func (*LogMgo) Create

func (l *LogMgo) Create(ctx context.Context, log []*relation.LogModel) error

func (*LogMgo) Delete

func (l *LogMgo) Delete(ctx context.Context, logID []string, userID string) error

func (*LogMgo) Get

func (l *LogMgo) Get(ctx context.Context, logIDs []string, userID string) ([]*relation.LogModel, error)

func (*LogMgo) Search

func (l *LogMgo) Search(ctx context.Context, keyword string, start time.Time, end time.Time, pagination pagination.Pagination) (int64, []*relation.LogModel, error)

type S3Mongo

type S3Mongo struct {
	// contains filtered or unexported fields
}

func (*S3Mongo) Delete

func (o *S3Mongo) Delete(ctx context.Context, engine string, name string) error

func (*S3Mongo) SetObject

func (o *S3Mongo) SetObject(ctx context.Context, obj *relation.ObjectModel) error

func (*S3Mongo) Take

func (o *S3Mongo) Take(ctx context.Context, engine string, name string) (*relation.ObjectModel, error)

type UserMgo

type UserMgo struct {
	// contains filtered or unexported fields
}

func (*UserMgo) AddUserCommand

func (u *UserMgo) AddUserCommand(ctx context.Context, userID string, Type int32, UUID string, value string, ex string) error

func (*UserMgo) CountRangeEverydayTotal

func (u *UserMgo) CountRangeEverydayTotal(ctx context.Context, start time.Time, end time.Time) (map[string]int64, error)

func (*UserMgo) CountTotal

func (u *UserMgo) CountTotal(ctx context.Context, before *time.Time) (count int64, err error)

func (*UserMgo) Create

func (u *UserMgo) Create(ctx context.Context, users []*relation.UserModel) error

func (*UserMgo) DeleteUserCommand

func (u *UserMgo) DeleteUserCommand(ctx context.Context, userID string, Type int32, UUID string) error

func (*UserMgo) Exist

func (u *UserMgo) Exist(ctx context.Context, userID string) (exist bool, err error)

func (*UserMgo) Find

func (u *UserMgo) Find(ctx context.Context, userIDs []string) (users []*relation.UserModel, err error)

func (*UserMgo) GetAllUserID

func (u *UserMgo) GetAllUserID(ctx context.Context, pagination pagination.Pagination) (int64, []string, error)

func (*UserMgo) GetUserGlobalRecvMsgOpt

func (u *UserMgo) GetUserGlobalRecvMsgOpt(ctx context.Context, userID string) (opt int, err error)

func (*UserMgo) Page

func (u *UserMgo) Page(ctx context.Context, pagination pagination.Pagination) (count int64, users []*relation.UserModel, err error)

func (*UserMgo) PageFindUser

func (u *UserMgo) PageFindUser(ctx context.Context, level1 int64, level2 int64, pagination pagination.Pagination) (count int64, users []*relation.UserModel, err error)

func (*UserMgo) PageFindUserWithKeyword

func (u *UserMgo) PageFindUserWithKeyword(
	ctx context.Context,
	level1 int64,
	level2 int64,
	userID string,
	nickName string,
	pagination pagination.Pagination,
) (count int64, users []*relation.UserModel, err error)

func (*UserMgo) Take

func (u *UserMgo) Take(ctx context.Context, userID string) (user *relation.UserModel, err error)

func (*UserMgo) TakeByNickname

func (u *UserMgo) TakeByNickname(ctx context.Context, nickname string) (user []*relation.UserModel, err error)

func (*UserMgo) TakeNotification

func (u *UserMgo) TakeNotification(ctx context.Context, level int64) (user []*relation.UserModel, err error)

func (*UserMgo) UpdateByMap

func (u *UserMgo) UpdateByMap(ctx context.Context, userID string, args map[string]any) (err error)

func (*UserMgo) UpdateUserCommand

func (u *UserMgo) UpdateUserCommand(ctx context.Context, userID string, Type int32, UUID string, val map[string]any) error

Jump to

Keyboard shortcuts

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