Versions in this module Expand all Collapse all v1 v1.0.10 Oct 7, 2023 v1.0.9 Oct 7, 2023 v1.0.8 Sep 26, 2023 v1.0.7 Sep 17, 2023 v1.0.6 Sep 13, 2023 Changes in this version + var GlobCache *jcache.Client v1.0.5 Sep 11, 2023 Changes in this version + var CacheKeyPrefix = config.GlobConfig().Main.ServerName type GetChatMessageListFilter + func (f *GetChatMessageListFilter) SetLastMessageID(val int64) *GetChatMessageListFilter + func (f *GetChatMessageListFilter) SetLimit(val int) *GetChatMessageListFilter + func (f *GetChatMessageListFilter) SetSort(val any) *GetChatMessageListFilter v1.0.4 Sep 10, 2023 v1.0.3 Sep 8, 2023 Changes in this version + type GetChatMessageListFilter struct + LastMessageID *int64 + Limit *int + RoomID string + SessionType int + Sort any v1.0.2 Sep 7, 2023 v1.0.1 Sep 6, 2023 v1.0.0 Sep 6, 2023 Changes in this version + const ChatMessageBodyFormatGIF + const ChatMessageBodyFormatJPEG + const ChatMessageBodyFormatMP3 + const ChatMessageBodyFormatMP4 + const ChatMessageBodyFormatVMA + const ChatMessageBodyFormatWEBP + const ChatMessageSessionTypeGroup + const ChatMessageSessionTypePrivate + const ChatMessageSessionTypeWorld + const ChatMessageTypeLocation + const ChatMessageTypePicture + const ChatMessageTypePlainText + const ChatMessageTypeVideo + const ChatMessageTypeVoice + const CollectionMessage + const CollectionRoom + const DatabaseMongodbIM + const DatabaseMySQLIM + const GroupMaxMember + const TableGroupMembers + const TableGroups + const TableUserRelation + const TableUserRelationInvite + const TableUsers + const UserRelationInviteStatusAgree + const UserRelationInviteStatusPending + const UserRelationInviteStatusReject + var GlobCtx = context.Background() + func AddChatMessage(msg *ChatMessage) error + func AddChatMessageTx(msg *ChatMessage) error + func AddGroup(group *Group, opts ...*SetOptions) (int64, error) + func AddGroupMembers(groupID int64, data *AddGroupMembersData, opts ...*SetOptions) (int64, error) + func AddUser(user *User, opts ...*SetOptions) error + func AddUserRelation(relation *UserRelation, opts ...*SetOptions) (id int64, err error) + func AddUserRelationInvite(invite *UserRelationInvite, opts ...*SetOptions) error + func CreateUserRelationTx(relation *UserRelation) (id int64, err error) + func GetGroupMemberCount(groupID int64, opts ...*GetOptions) (int64, error) + func GetGroupMemberIDs(groupID int64, opts ...*GetOptions) ([]int64, error) + func GetGroupMemberIDsString(groupID int64, opts ...*GetOptions) ([]string, error) + func RemoveGroupMembers(filter *RemoveGroupMembersFilter, opts ...*SetOptions) (int64, error) + func RollbackChatMessage(id primitive.ObjectID) (bool, error) + func UpdateGroup(groupID int64, data *UpdateGroupData, opts ...*SetOptions) error + func UpdateGroupMember(groupID, userID int64, data *UpdateGroupMemberData, opts ...*SetOptions) error + func UpdateGroupTx(groupID int64, data *UpdateGroupData) (err error) + func UpdateUserRelation(filter *UpdateUserRelationFilter, data *UpdateUserRelationData, ...) (int64, error) + func UpdateUserRelationInvite(filter *UpdateUserRelationInviteFilter, data *UpdateUserRelationInviteData, ...) (int64, error) + func UpdateUserRelationTx(filter *UpdateUserRelationFilter, data *UpdateUserRelationData) (rowsAffected int64, err error) + func UserExist(id int64) (bool, error) + func UserExistByUsername(username string) (bool, error) + type AddGroupMembersData struct + CreatedAt time.Time + CreatorID int64 + UserIDs []int64 + type ChatMessage struct + Body ChatMessageBody + CreatedAt int64 + ID primitive.ObjectID + MessageID int64 + ReadStatus int + ReceiverID int64 + RoomID string + SendStatus int + SenderID int64 + SessionType int + Status int + Type int + UpdatedAt int64 + func GetChatMessageList(roomID string, sessionType int, opts ...*GetChatMessageListOptions) ([]*ChatMessage, error) + func GetLastChatMessageList(roomID string, sessionType int, opts ...*GetOptions) ([]*ChatMessage, error) + func (m *ChatMessage) MarshalBinary() ([]byte, error) + func (m *ChatMessage) UnmarshalBinary(data []byte) error + type ChatMessageBody struct + Format string + Latitude string + LocationLabel string + Longitude string + Scale float64 + Size string + Src string + Text string + type ChatRoom struct + CreatedAt int64 + ID primitive.ObjectID + LastMessage ChatMessage + LastMessageID int64 + RoomID string + SessionType int + UpdatedAt int64 + type Database struct + Mongo *mongo.Client + MySQL *sqlx.DB + Redis redis.UniversalClient + var GlobDB *Database + func Init(cfg config.Config) (db *Database, err error) + type GetChatMessageListOptions struct + LastMessageID int64 + Limit int64 + Sort any + func NewChatMessageListOptions() *GetChatMessageListOptions + func (opt *GetChatMessageListOptions) SetLastMessageID(val int64) *GetChatMessageListOptions + func (opt *GetChatMessageListOptions) SetLimit(val int64) *GetChatMessageListOptions + func (opt *GetChatMessageListOptions) SetSort(val any) *GetChatMessageListOptions + type GetOptions struct + func MergeGetOptions(opts []*GetOptions) *GetOptions + func NewGetOptions() *GetOptions + func NewGetOptionsFromSetOptions(setOpt *SetOptions) *GetOptions + func (opt *GetOptions) SetSQLExt(ext sqlx.Ext) *GetOptions + func (opt *GetOptions) SetUpdateCache(val bool) *GetOptions + func (opt *GetOptions) SetUseCache(val bool) *GetOptions + func (opt *GetOptions) UpdateCache() bool + func (opt *GetOptions) UseCache() bool + type Group struct + CreatedAt time.Time + CreatorID int64 + ID int64 + MaxMember int + Name string + OwnerID int64 + SpeakStatus int + UpdatedAt time.Time + UpdaterID int64 + func CreateGroupTx(creatorID int64, memberIDs []int64) (group *Group, err error) + func GetGroup(id int64, opts ...*GetOptions) (*Group, error) + type GroupMember struct + CreatedAt time.Time + CreatorID int64 + GroupID int64 + ID int64 + Role int + SpeakStatus int + UpdatedAt time.Time + UpdaterID int64 + UserID int64 + func GetGroupAllMembers(groupID int64, opts ...*GetOptions) ([]*GroupMember, error) + func GetGroupMember(groupID, memberID int64, opts ...*GetOptions) (*GroupMember, error) + func GetGroupMembers(groupID int64, memberIDs []int64, opts ...*GetOptions) ([]*GroupMember, error) + type RemoveGroupMembersFilter struct + GroupID int64 + Roles []int + UserIDs []int64 + type SQLOptions struct + func (opt *SQLOptions) IsSQLTx() bool + func (opt *SQLOptions) SQLExt() sqlx.Ext + func (opt *SQLOptions) SetSQLExt(ext sqlx.Ext) *SQLOptions + type SearchUsersFilter struct + Limit int64 + Nickname *string + StartID int64 + UserID *int64 + type SetOptions struct + func MergeSetOptions(opts []*SetOptions) *SetOptions + func NewSetOptions() *SetOptions + func NewSetOptionsFromGetOptions(getOpt *GetOptions) *SetOptions + func NewSetOptionsWithSQLExt(ext sqlx.Ext) *SetOptions + func (opt *SetOptions) SetSQLExt(ext sqlx.Ext) *SetOptions + func (opt *SetOptions) SetUpdateCache(val bool) *SetOptions + func (opt *SetOptions) UpdateCache() bool + type UpdateGroupData struct + MaxMember *int + Name *string + OwnerID *int64 + SpeakStatus *int + UpdatedAt time.Time + UpdaterID int64 + type UpdateGroupMemberData struct + Role *int + SpeakStatus *int + UpdatedAt time.Time + UpdaterID int64 + type UpdateUserRelationData struct + BlockStatus *int + RemarkOnA *string + RemarkOnB *string + Status *int + UpdatedAt time.Time + func (opt *UpdateUserRelationData) SetBlockStatus(val int) *UpdateUserRelationData + func (opt *UpdateUserRelationData) SetStatus(val int) *UpdateUserRelationData + func (opt *UpdateUserRelationData) SetUpdatedAt(val time.Time) *UpdateUserRelationData + type UpdateUserRelationFilter struct + ID int64 + UserAID int64 + UserBID int64 + type UpdateUserRelationInviteData struct + Reply string + Status int + UpdatedAt time.Time + type UpdateUserRelationInviteFilter struct + ID int64 + TargetID int64 + UserID int64 + type User struct + Avatar string + BirthDate *time.Time + CreatedAt time.Time + ID int64 + Nickname string + OnlineStatus int + Password string + Status int + UpdatedAt time.Time + Username string + func GetUser(id int64, opts ...*GetOptions) (*User, error) + func GetUserByUsername(username string, opts ...*GetOptions) (*User, error) + func GetUsers(ids []int64, opts ...*GetOptions) ([]*User, error) + func SearchUsers(filter *SearchUsersFilter, opts ...*GetOptions) ([]*User, error) + func (u *User) MarshalBinary() (data []byte, err error) + func (u *User) String() string + func (u *User) UnmarshalBinary(data []byte) error + type UserRelation struct + BlockStatus int + CreatedAt time.Time + ID int64 + RemarkOnA string + RemarkOnB string + Status int + UpdatedAt time.Time + UserAID int64 + UserBID int64 + func GetUserRelation(id int64, opts ...*GetOptions) (*UserRelation, error) + func GetUserRelationByUsersID(userAID int64, userBID int64, opts ...*GetOptions) (*UserRelation, error) + func (r *UserRelation) MarshalBinary() (data []byte, err error) + func (r *UserRelation) UnmarshalBinary(data []byte) error + type UserRelationInvite struct + CreatedAt time.Time + ID int64 + Note string + Reply string + Status int + TargetID int64 + UQFlag string + UpdatedAt time.Time + UserID int64 + func GetLastUserRelationInvite(userID, targetID int64, opts ...*GetOptions) (*UserRelationInvite, error) + func GetUserRelationInvite(id int64, opts ...*GetOptions) (*UserRelationInvite, error) + func (i *UserRelationInvite) MarshalBinary() (data []byte, err error) + func (i *UserRelationInvite) UnmarshalBinary(data []byte) error