Documentation ¶
Index ¶
- Constants
- Variables
- func DeleteOneFriendReal(selfId, friendId int64) error
- func DeleteOneGroupChatByIdReal(id int64) error
- func DeleteOneSubscriptionReal(id int64) error
- func DeleteOneUserByIdReal(id int64) error
- func DeleteOneUserGroupChatReal(groupId, userId int64) error
- func DeleteOneUserSubscriptionReal(subsId, userId int64) error
- func InsertOneNewFriend(selfId, friendId int64, friendNote string) error
- func InsertOneNewFriendPlus(selfId, friendId int64, friendNote string) error
- func SelectBlacklistFriendsIdPlus(selfId int64) ([]int64, error)
- func SelectEffectiveFriendsIdPlus(selfId int64) ([]int64, error)
- func SelectFriendsIdByOptions(selfId int64, isAccept, isBlack, isDelete bool) ([]int64, error)
- func SelectGroupChatsIdOfUser(userId int64, isDelete bool) ([]int64, error)
- func SelectOneUserPasswordByEmail(email string) (string, error)
- func SelectOneUserPasswordById(id int64) (string, error)
- func SelectSubscriptionsIdOfUser(userId int64, isDelete bool) ([]int64, error)
- func SelectUsersIdOfGroupChat(groupId int64, isDelete bool) ([]int64, error)
- func SelectUsersIdOfSubscription(subsId int64, isDelete bool) ([]int64, error)
- func UpdateAcceptOneNewFriendPlus(selfId, friendId int64, friendNote string, isAccept bool) error
- func UpdateDeleteOneFriendPlus(selfId, friendId int64) error
- func UpdateOneFriendIsAccept(selfId, friendId int64, isAccept bool) error
- func UpdateOneFriendIsBlack(selfId, friendId int64, isBlack bool) error
- func UpdateOneFriendIsDelete(selfId, friendId int64, isDelete bool) error
- func UpdateOneFriendNote(selfId, friendId int64, friendNote string) error
- func UpdateOneGroupChatAvatarById(id int64, newAvatar string) error
- func UpdateOneGroupChatIsDeleteById(id int64, isDelete bool) error
- func UpdateOneGroupChatManagerById(id, newManagerId int64) error
- func UpdateOneGroupChatNameById(id int64, newName string) error
- func UpdateOneGroupChatQrCodeById(id int64, newQrCode string) error
- func UpdateOneSubscriptionAvatarById(newAvatar string, id int64) error
- func UpdateOneSubscriptionIntroById(newIntro string, id int64) error
- func UpdateOneSubscriptionIsDeleteById(isDelete bool, id int64) error
- func UpdateOneSubscriptionManagerById(newManagerId, id int64) error
- func UpdateOneSubscriptionNameById(newName string, id int64) error
- func UpdateOneSubscriptionQrCodeById(newQrCode string, id int64) error
- func UpdateOneUserAvatarById(avatar string, id int64) error
- func UpdateOneUserGroupChatIsDelete(isDelete bool, groupId, userId int64) error
- func UpdateOneUserGroupChatNote(newNote string, groupId, userId int64) error
- func UpdateOneUserIsDeleteById(isDelete bool, id int64) error
- func UpdateOneUserPasswordById(password string, id int64) error
- func UpdateOneUserProfileByIdPlus(name, mobile string, gender int32, id int64) error
- func UpdateOneUserQrCodeById(qrCode string, id int64) error
- func UpdateOneUserSubscriptionIsDelete(isDelete bool, subsId, userId int64) error
- type JoinTableFriendInfo
- type JoinTableGroupChatUsersInfo
- type JoinTableSubscriptionUsersInfo
- type JoinTableUserGroupChatsInfo
- type JoinTableUserSubscriptionsInfo
- type TableFriendship
- type TableGroupChat
- func InsertOneNewGroupChat(name, avatar, qrCode string, managerId int64) (*TableGroupChat, error)
- func InsertOneNewGroupChatPlus(name, avatar, qrCode string, managerId int64) (*TableGroupChat, error)
- func SelectAllGroupChat() ([]*TableGroupChat, error)
- func SelectManyGroupChatByManagerId(managerId int64, isDelete bool) ([]*TableGroupChat, error)
- func SelectManyGroupChatByName(name string, isDelete bool) ([]*TableGroupChat, error)
- func SelectOneGroupChatById(id int64, isDelete bool) (*TableGroupChat, error)
- func SelectOneGroupChatByNameAndManager(name string, managerId int64) (*TableGroupChat, error)
- type TableSubscription
- func InsertOneNewSubscription(name, intro, avatar, qrCode string, managerId int64) (*TableSubscription, error)
- func InsertOneNewSubscriptionPlus(name, intro, avatar, qrCode string, managerId int64) (*TableSubscription, error)
- func SelectManySubscriptionByManagerId(managerId int64, isDelete bool) ([]*TableSubscription, error)
- func SelectOneSubscriptionById(id int64, isDelete bool) (*TableSubscription, error)
- func SelectOneSubscriptionByName(name string, isDelete bool) (*TableSubscription, error)
- type TableUserBasic
- func InsertOneNewUser(email, name, password, mobile string, gender int32, avatar, qrCode string, ...) (*TableUserBasic, error)
- func SelectAllUsers() ([]*TableUserBasic, error)
- func SelectManyUserByName(name string, isDelete bool) ([]*TableUserBasic, error)
- func SelectOneUserByEmail(email string, isDelete bool) (*TableUserBasic, error)
- func SelectOneUserById(id int64, isDelete bool) (*TableUserBasic, error)
- type TableUserGroupChat
- func InsertOneNewUserGroupChat(groupId, userId int64, userNote string) (*TableUserGroupChat, error)
- func SelectAllUserGroupChat() ([]*TableUserGroupChat, error)
- func SelectManyUserGroupChatByGroupId(groupId int64, isDelete bool) ([]*TableUserGroupChat, error)
- func SelectManyUserGroupChatByUserId(userId int64, isDelete bool) ([]*TableUserGroupChat, error)
- func SelectOneUserGroupChat(groupId, userId int64) (*TableUserGroupChat, error)
- type TableUserSubscription
- func InsertOneNewUserSubscription(subsId, userId int64) (*TableUserSubscription, error)
- func SelectManyUserSubscriptionBySubsId(subsId int64, isDelete bool) ([]*TableUserSubscription, error)
- func SelectManyUserSubscriptionByUserId(userId int64, isDelete bool) ([]*TableUserSubscription, error)
- func SelectOneUserSubscription(subsId, userId int64) (*TableUserSubscription, error)
Constants ¶
const ( InsertOneNewUserSQL = `` /* 133-byte string literal not displayed */ DeleteOneUserRealSQL = `DELETE FROM tb_user_basic WHERE id = ?` )
const ( SelectUserBaseSQL = `SELECT id, email, name, password,mobile, gender, avatar, qr_code, is_delete FROM tb_user_basic` SelectOneUserByIdSQL = SelectUserBaseSQL + ` WHERE id = ? AND is_delete = ?` SelectOneUserByEmailSQL = SelectUserBaseSQL + ` WHERE email = ? AND is_delete = ?` SelectManyUserByNameSQL = SelectUserBaseSQL + ` WHERE name = ? AND is_delete = ?` SelectOneUserPasswordByIdSQL = `SELECT password FROM tb_user_basic WHERE id = ?` SelectOneUserPasswordByEmailSQL = `SELECT password FROM tb_user_basic WHERE email = ?` )
const ( UpdateOneUserProfileSQL = `UPDATE tb_user_basic SET name = ?, mobile = ?, gender = ? WHERE id = ?` UpdateOneUserAvatarSQL = `UPDATE tb_user_basic SET avatar = ? WHERE id = ?` UpdateOneUserQrCodeSQL = `UPDATE tb_user_basic SET qr_code = ? WHERE id = ?` UpdateOneUserPasswordSQL = `UPDATE tb_user_basic SET password = ? WHERE id = ?` UpdateOneUserIsDeleteSQL = `UPDATE tb_user_basic SET is_delete = ? WHERE id = ?` )
const ( InsertOneNewFriendSQL = `` /* 173-byte string literal not displayed */ DeleteOneFriendshipRealSQL = `DELETE FROM tb_friendship WHERE self_id = ? AND friend_id = ?` )
const ( SelectFriendshipBaseSQL = `SELECT self_id, friend_id, friend_note, is_accept, is_black, is_delete FROM tb_friendship` SelectOneFriendshipSQL = SelectFriendshipBaseSQL + ` WHERE self_id= ? AND friend_id= ?` SelectFriendsIdByOptionsSQL = `SELECT friend_id FROM tb_friendship WHERE self_id= ? AND is_accept= ? AND is_black= ? AND is_delete= ?` )
const ( UpdateOneFriendNoteSQL = `UPDATE tb_friendship SET friend_note= ? WHERE self_id= ? AND friend_id= ?` UpdateOneFriendIsAcceptSQL = `INSERT INTO tb_friendship (self_id, friend_id, is_accept) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE is_accept= ?` UpdateOneFriendIsBlackSQL = `INSERT INTO tb_friendship (self_id, friend_id, is_black) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE is_black= ?` UpdateOneFriendIsDeleteSQL = `UPDATE tb_friendship SET is_delete= ? WHERE self_id=? AND friend_id= ?` )
const ( InsertOneNewGroupChatSQL = `` /* 148-byte string literal not displayed */ DeleteOneGroupChatRealSQL = `DELETE FROM tb_group_chat WHERE id = ?` )
const ( SelectGroupChatBaseSQL = `SELECT id, name, manager_id, avatar, qr_code, is_delete FROM tb_group_chat` SelectGroupChatByIdSQL = SelectGroupChatBaseSQL + ` WHERE id= ? AND is_delete= ?` SelectGroupChatsByNameSQL = SelectGroupChatBaseSQL + ` WHERE name= ? AND is_delete= ?` SelectGroupChatsByManagerIdSQl = SelectGroupChatBaseSQL + ` WHERE manager_id=? AND is_delete= ?` SelectGroupChatByNameAndManagerSQL = SelectGroupChatBaseSQL + ` WHERE name= ? AND manager_id= ? AND is_delete= False` )
const ( UpdateOneGroupChatNameByIdSQL = `UPDATE tb_group_chat SET name = ? WHERE id = ?` UpdateOneGroupChatManagerByIdSQL = `UPDATE tb_group_chat SET manager_id = ? WHERE id = ?` UpdateOneGroupChatAvatarByIdSQL = `UPDATE tb_group_chat SET avatar = ? WHERE id = ?` UpdateOneGroupChatQrCodeByIdSQL = `UPDATE tb_group_chat SET qr_code = ? WHERE id = ?` UpdateOneGroupChatIsDeleteByIdSQL = `UPDATE tb_group_chat SET is_delete = ? WHERE id = ?` )
const ( InsertOneNewUserGroupChatSQL = `` /* 132-byte string literal not displayed */ DeleteOneUserGroupChatRealSQL = `DELETE FROM tb_user_group_chat WHERE group_id= ? AND user_id= ?` )
const ( SelectUserGroupChatBaseSQL = `SELECT group_id, user_id, user_note, is_delete FROM tb_user_group_chat` SelectOneUserGroupChatByGIDAndUIDSQL = SelectUserGroupChatBaseSQL + ` WHERE group_id= ? AND user_id= ?` SelectManyUserGroupChatByGroupIdSQL = SelectUserGroupChatBaseSQL + ` WHERE group_id= ? AND is_delete= ?` SelectManyUserGroupChatByUserIdSQL = SelectUserGroupChatBaseSQL + ` WHERE user_id= ? AND is_delete= ?` SelectUsersIdOfGroupChatSQL = `SELECT user_id FROM tb_user_group_chat WHERE group_id= ? AND is_delete= ?` SelectGroupChatsIdOfUserSQL = `SELECT group_id FROM tb_user_group_chat WHERE user_id= ? AND is_delete= ?` )
const ( UpdateOneUserGroupChatNoteSQL = `UPDATE tb_user_group_chat SET user_note= ? WHERE group_id= ? AND user_id= ?` UpdateOneUserGroupChatIsDeleteSQL = `UPDATE tb_user_group_chat SET is_delete= ? WHERE group_id= ? AND user_id= ?` )
const ( InsertOneNewSubscriptionSQL = `INSERT INTO tb_subscription(id, name, manager_id, intro, avatar, qr_code) VALUES(?, ?, ?, ?, ?, ?)` DeleteOneSubscriptionRealSQL = `DELETE FROM tb_subscription WHERE id= ?` )
const ( SelectSubscriptionBaseSQL = `SELECT id,name,manager_id,intro,avatar,qr_code,is_delete FROM tb_subscription` SelectOneSubscriptionByIdSQL = SelectSubscriptionBaseSQL + ` WHERE id= ? AND is_delete= ?` SelectOneSubscriptionByNameSQL = SelectSubscriptionBaseSQL + ` WHERE name= ? AND is_delete= ?` SelectManySubscriptionByManagerIdSQL = SelectSubscriptionBaseSQL + ` WHERE manager_id= ? AND is_delete= ?` )
const ( UpdateOneSubscriptionNameByIdSQL = `UPDATE tb_subscription SET name= ? WHERE id=?` UpdateOneSubscriptionManagerByIdSQL = `UPDATE tb_subscription SET manager_id= ? WHERE id=?` UpdateOneSubscriptionIntroduceByIdSQL = `UPDATE tb_subscription SET intro= ? WHERE id=?` UpdateOneSubscriptionAvatarByIdSQL = `UPDATE tb_subscription SET avatar= ? WHERE id= ?` UpdateOneSubscriptionQrCodeByIdSQL = `UPDATE tb_subscription SET qr_code= ? WHERE id= ?` UpdateOneSubscriptionIsDeleteByIdSQL = `UPDATE tb_subscription SET is_delete= ? WHERE id= ?` )
const ( InsertOneNewUserSubscriptionSQL = `INSERT INTO tb_user_subscription(subs_id, user_id) VALUES(?, ?)` DeleteOneUserSubscriptionRealSQL = `DELETE FROM tb_user_subscription WHERE subs_id= ? AND user_id= ?` )
const ( SelectUserSubscriptionBaseSQL = `SELECT subs_id, user_id, is_delete FROM tb_user_subscription` SelectOneUserSubscriptionByIdsSQL = SelectUserSubscriptionBaseSQL + ` WHERE subs_id= ? AND user_id= ?` SelectManyUserSubscriptionBySubsIdSQL = SelectUserSubscriptionBaseSQL + ` WHERE subs_id= ? AND is_delete= ?` SelectManyUserSubscriptionByUserIdSQL = SelectUserSubscriptionBaseSQL + ` WHERE user_id= ? AND is_delete= ?` SelectUsersIdOfSubscriptionSQL = `SELECT user_id FROM tb_user_subscription WHERE subs_id= ? AND is_delete= ?` SelectSubscriptionsIdOfUserSQL = `SELECT subs_id FROM tb_user_subscription WHERE user_id= ? AND is_delete= ?` )
const ( SelectOneFriendIsBlackSQL = `SELECT is_black FROM tb_friendship WHERE self_id= ? AND friend_id= ?` SelectOneFriendIsAcceptSQL = `SELECT is_accept FROM tb_friendship WHERE self_id= ? AND friend_id= ?` )
const ( SelectAllFriendsInfoPlusSQL = `` /* 293-byte string literal not displayed */ SelectEffectiveFriendsInfoPlusSQL = `` /* 340-byte string literal not displayed */ SelectBlacklistFriendsInfoPlusSQL = `` /* 311-byte string literal not displayed */ SelectEffectiveFriendsIdPlusSQL = `SELECT friend_id FROM tb_friendship WHERE self_id = ? AND is_accept = TRUE AND is_black = FALSE AND is_delete = FALSE` SelectBlacklistFriendsIdPlusSQL = `SELECT friend_id FROM tb_friendship WHERE self_id = ? AND is_black = TRUE AND is_delete = FALSE` )
const ( SelectOneGroupChatIsDeleteById = `SELECT is_delete FROM tb_group_chat WHERE id= ?` SelectGroupChatUsersInfoPlusSQL = `` /* 280-byte string literal not displayed */ )
const ( SelectOneUserIsDeleteById = `SELECT is_delete FROM tb_user_basic WHERE id= ?` SelectUserGroupChatsInfoPlusSQL = `` /* 248-byte string literal not displayed */ )
const ( SelectSubscriptionsOfUserPlusSQL = `` /* 268-byte string literal not displayed */ SelectUsersOfSubscriptionPlusSQL = `` /* 254-byte string literal not displayed */ )
const (
UpdateOneUserSubscriptionIsDeleteSQL = `UPDATE tb_user_subscription SET is_delete= ? WHERE subs_id= ? AND user_id= ?`
)
Variables ¶
var ( ErrAffectZeroCount = errors.New("0 row affected") ErrUserNotFound = errors.New("the user not found") ErrFriendNotFound = errors.New("the friend not found") ErrNotFriendYet = errors.New("you are not friends yet") ErrInBlackList = errors.New("you are in the blacklist of target user") ErrFriendshipAlreadyInEffect = errors.New("your friendship already in effect") ErrNotTheFriendRequest = errors.New("not have the friend request you can accept") ErrGroupChatNotFound = errors.New("the group chat not found") ErrSubscriptionNotFound = errors.New("the subscription not found") )
Functions ¶
func DeleteOneFriendReal ¶
Delete one row data which find by 'self_id' and 'friend_id' in 'tb_friendship' table really.
func DeleteOneGroupChatByIdReal ¶
Delete one row data from 'tb_group_chat' by 'id' really
func DeleteOneSubscriptionReal ¶
Delete one row data from 'tb_subscription' table by 'id' really
func DeleteOneUserByIdReal ¶
Delete one row data which find by 'id' in 'tb_user_basic' table really.
func DeleteOneUserGroupChatReal ¶
Delete one row data from 'tb_user_group_chat' table really
func DeleteOneUserSubscriptionReal ¶
Delete one row data from 'tb_user_subscription' table really.
func InsertOneNewFriend ¶
Insert one new row data in 'tb_friendship' table. if the record was existed, update it.
func InsertOneNewFriendPlus ¶
Insert one new row data into 'tb_friendship' table for the request that adding a new friend. It will checking the target user if existed and if there has an effect friendship record for them before insert the one new row data.
func SelectBlacklistFriendsIdPlus ¶
Get the id of user's friends whom are in user's blacklist
func SelectEffectiveFriendsIdPlus ¶
Get value of 'friend_id' column belong to the one row data which selected from 'tb_friendship' table by 'self_id'. Require the 'is_accept' is 'true' and 'is_black' is 'false' at the same time, meaning it would not include the friends who in user's blacklist.
func SelectFriendsIdByOptions ¶
Select the values of 'friend_id' column from 'tb_friendship' table by 'self_id', 'is_accept', 'is_black' and 'is_delete'
func SelectGroupChatsIdOfUser ¶
Select the values of 'group_id' column from 'tb_user_group_chat' table by 'user_id' and 'is_delete'.
func SelectOneUserPasswordByEmail ¶
Get the value of 'password' column belong to one row data which selected from 'tb_user_basic' table by 'email'
func SelectOneUserPasswordById ¶
Get the value of 'password' column belong to one row data which selected from 'tb_user_basic' table by 'id'.
func SelectSubscriptionsIdOfUser ¶
Select the values of the 'subs_id' column in 'tb_user_subscription' table by 'user_id'.
func SelectUsersIdOfGroupChat ¶
Select the values of 'user_id' column from 'tb_user_group_chat' table by 'group_id' and 'is_delete'
func SelectUsersIdOfSubscription ¶
Select the values of the 'user_id' column in 'tb_user_subscription' table by 'subs_id'.
func UpdateAcceptOneNewFriendPlus ¶
Insert one new row data into 'tb_friendship' table to accept the request that adding a new friend or not. It will checking the friend request record if existed and if there has an effect friendship record for then before insert the new one row data.And then, if the 'isAccept' is false, it will also insert one new data to record the requester is added into the recipient's blacklist
func UpdateDeleteOneFriendPlus ¶
Update the 'is_delete' column of the two row data which find by 'selfId' and 'friendId' in 'tb_friendship' table. Meaning if the user remove a friend from self's friend list, will also remove the user from the friend's friend list.
func UpdateOneFriendIsAccept ¶
Update the 'is_accept' column of the one row data which find by 'self_id' and 'friend_id' in 'tb_friendship' table.
func UpdateOneFriendIsBlack ¶
Update the 'is_black' column of the one row data which find by 'self_id' and 'friend_id' in 'tb_friendship' table.
func UpdateOneFriendIsDelete ¶
Update the 'is_delete' column of the one row data which find by 'self_id' and 'friend_id' in 'tb_friendship' table.
func UpdateOneFriendNote ¶
Update the 'friend_note' column of the one row data which find by 'self_id' and 'friend_id' in 'tb_friendship' table.
func UpdateOneGroupChatAvatarById ¶
Update the 'avatar' column of the one row data which find by 'id' in 'tb_group_chat' table
func UpdateOneGroupChatIsDeleteById ¶
Update the 'is_delete' column of the one row data which find by 'id' in 'tb_group_chat' table
func UpdateOneGroupChatManagerById ¶
Update the 'manager_id' column of the one row data which find by 'id' in 'tb_group_chat' table
func UpdateOneGroupChatNameById ¶
Update the 'name' column of the one row data which find by 'id' in 'tb_group_chat' table
func UpdateOneGroupChatQrCodeById ¶
Update the 'qr_code' column of the one row data which find by 'id' in 'tb_group_chat' table
func UpdateOneSubscriptionAvatarById ¶
Update the 'avatar' column of the one row data which find by 'id' in 'tb_subscription' table.
func UpdateOneSubscriptionIntroById ¶
Update the 'introduce' column of the one row data which find by 'id' in 'tb_subscription' table.
func UpdateOneSubscriptionIsDeleteById ¶
Update the 'is_delete' column of the one row data which find by 'id' in 'tb_subscription' table.
func UpdateOneSubscriptionManagerById ¶
Update the 'manager_id' column of the one row data which find by 'id' in 'tb_subscription' table.
func UpdateOneSubscriptionNameById ¶
Update the 'name' column of the one row data which find by 'id' in 'tb_subscription' table.
func UpdateOneSubscriptionQrCodeById ¶
Update the 'qr_code' column of the one row data which find by 'id' in 'tb_subscription' table.
func UpdateOneUserAvatarById ¶
Update the 'avatar' column of the one row data which find by 'id' in 'tb_user_basic' table.
func UpdateOneUserGroupChatIsDelete ¶
Update the 'is_delete' column of one row data which found by 'group_id' and 'user_id' in 'tb_user_group_chat' table.
func UpdateOneUserGroupChatNote ¶
Update the 'user_note' column of one row data which found by 'group_id' and 'user_id' in 'tb_user_group_chat' table.
func UpdateOneUserIsDeleteById ¶
Update the 'is_delete' column of the one row data which find by 'id' in 'tb_user_basic' table.
func UpdateOneUserPasswordById ¶
Update the 'password' column of the one row data which find by 'id' in 'tb_user_basic' table.
func UpdateOneUserProfileByIdPlus ¶
Update 'name', 'mobile' and 'gender' columns of one row data which find by 'id' in 'tb_user_basic' table. It will checking the target user if existed and if nothing need be update before updating.
func UpdateOneUserQrCodeById ¶
Update the 'qr_code' column of the one row data which find by 'id' in 'tb_user_basic' table.
func UpdateOneUserSubscriptionIsDelete ¶
Update the 'is_delete' of one row data in 'tb_user_subscription' table.
Types ¶
type JoinTableFriendInfo ¶
type JoinTableFriendInfo struct { Id int64 `json:"id"` Note string `json:"note"` Email string `json:"email"` Name string `json:"name"` Mobile string `json:"mobile"` Gender int32 `json:"gender"` Avatar string `json:"avatar"` IsAccept bool `json:"is_accept"` IsBlack bool `json:"is_black"` IsDelete bool `json:"is_delete"` }
Friend's information from 'tb_user_basic' and 'tb_friendship' table joined. Because protocol buffer 3 only have int32, so 'Gender' also use int32 here.
func SelectAllFriendsInfoPlus ¶
func SelectAllFriendsInfoPlus(selfId int64) ([]*JoinTableFriendInfo, error)
Get the information of user's all friends, which just require the 'is_accept' is 'true' in 'tb_friendship' table. Meaning it would include the friends who in user's blacklist or the friends user have deleted.
func SelectBlacklistFriendsInfoPlus ¶
func SelectBlacklistFriendsInfoPlus(selfId int64) ([]*JoinTableFriendInfo, error)
Get the information of user's friends whom are in user's blacklist
func SelectEffectiveFriendsInfoPlus ¶
func SelectEffectiveFriendsInfoPlus(selfId int64) ([]*JoinTableFriendInfo, error)
Get the information of user's effective friends, which 'is_accept' is 'true', 'is_black' and 'is_delete' is 'false' in 'tb_friendship' table, meaning it would not include the friends who in user's blacklist or the friends have deleted.
type JoinTableGroupChatUsersInfo ¶
type JoinTableGroupChatUsersInfo struct { GroupId int64 `json:"group_id"` UserId int64 `json:"user_id"` UserNote string `json:"user_note"` UserName string `json:"user_name"` UserGender int32 `json:"user_gender"` UserEmail string `json:"user_email"` UserAvatar string `json:"user_avatar"` }
The information of users whom are the member of the group chat Because protocol buffer 3 only have int32, so 'Gender' also use int32 here.
func SelectGroupChatUsersInfoPlus ¶
func SelectGroupChatUsersInfoPlus(groupId int64) ([]*JoinTableGroupChatUsersInfo, error)
Get the information of the users whom are member of one group chat. Requiring the 'is_delete' is 'false' both in 'tb_user_group_chat' and 'tb_user_basic'. Meaning only can find effective members of the group chat. It will checking the group chat is still not dissolved before query data.
type JoinTableSubscriptionUsersInfo ¶
type JoinTableSubscriptionUsersInfo struct { SubsId int64 `json:"subs_id"` UserId int64 `json:"user_id"` Email string `json:"email"` Name string `json:"name"` Gender int32 `json:"gender"` }
The information of user whom was followed the subscription Because protocol buffer 3 only have int32, so 'Gender' also use int32 here.
func SelectUsersOfSubscriptionPlus ¶
func SelectUsersOfSubscriptionPlus(subsId int64) ([]*JoinTableSubscriptionUsersInfo, error)
Get the information of the user whom was followed the subscription. Requiring the 'is_delete' is 'false' both in 'tb_user_basic' and 'tb_user_subscription' table.
type JoinTableUserGroupChatsInfo ¶
type JoinTableUserGroupChatsInfo struct { UserId int64 `json:"user_id"` GroupId int64 `json:"group_id"` GroupName string `json:"group_name"` GroupAvatar string `json:"group_avatar"` GroupQrCode string `json:"group_qr_code"` }
The information of the group chat which the user have joined.
func SelectUserGroupChatsInfoPlus ¶
func SelectUserGroupChatsInfoPlus(userId int64) ([]*JoinTableUserGroupChatsInfo, error)
Get the information of the group chat which the user have joined. Requiring the 'is_delete' is 'false' both in 'tb_user_group_chat' and 'tb_group_chat' Meaning only can find effective group chat the user joined. It will check the value of 'is_delete' column in 'tb_user_basic' which found by 'user_id', before query data.
type JoinTableUserSubscriptionsInfo ¶
type JoinTableUserSubscriptionsInfo struct { UserId int64 `json:"user_id"` SubsId int64 `json:"subs_id"` Name string `json:"name"` Intro string `json:"intro"` Avatar string `json:"avatar"` QrCode string `json:"qr_code"` }
The information of the subscription those the user followed
func SelectSubscriptionsOfUserPlus ¶
func SelectSubscriptionsOfUserPlus(userId int64) ([]*JoinTableUserSubscriptionsInfo, error)
Get the information of the subscriptions which the user was followed. Requiring the 'is_delete' is 'false' both in 'tb_subscription' and 'tb_user_subscription' table.
type TableFriendship ¶
type TableFriendship struct { SelfId int64 `json:"self_id"` FriendId int64 `json:"friend_id"` FriendNote string `json:"friend_note"` IsAccept bool `json:"is_accept"` IsBlack bool `json:"is_black"` IsDelete bool `json:"is_delete"` }
friendship record information in 'tb_friendship' table
func SelectAllFriendship ¶
func SelectAllFriendship() ([]*TableFriendship, error)
Select all rows data from 'tb_friendship' table
func SelectOneFriendship ¶
func SelectOneFriendship(selfId, friendId int64) (*TableFriendship, error)
Select one row data from 'tb_friendship' table by 'self_id' and 'friend_id'.
type TableGroupChat ¶
type TableGroupChat struct { Id int64 `json:"id"` Name string `json:"name"` ManagerId int64 `json:"manager_id"` Avatar string `json:"avatar"` QrCode string `json:"qr_code"` IsDelete bool `json:"is_delete"` }
Group chat information in 'tb_group_chat'
func InsertOneNewGroupChat ¶
func InsertOneNewGroupChat(name, avatar, qrCode string, managerId int64) (*TableGroupChat, error)
Insert one new row data to save the information of an new group chat 'id' will generated by SnowFlakeNode, 'is_delete' use default value 'false'.
func InsertOneNewGroupChatPlus ¶
func InsertOneNewGroupChatPlus(name, avatar, qrCode string, managerId int64) (*TableGroupChat, error)
Insert one new row data into 'tb_group_chat' table with checking. It will check the user who is the manager of the group chat if existed before insert the new row data into 'tb_group_chat' table. Then will insert one row data into 'tb_user_group_chat' table at the same time.
func SelectAllGroupChat ¶
func SelectAllGroupChat() ([]*TableGroupChat, error)
Select all rows data from 'tb_group_chat' table
func SelectManyGroupChatByManagerId ¶
func SelectManyGroupChatByManagerId(managerId int64, isDelete bool) ([]*TableGroupChat, error)
Select many rows data from 'tb_group_chat' table by 'manager_id'.
func SelectManyGroupChatByName ¶
func SelectManyGroupChatByName(name string, isDelete bool) ([]*TableGroupChat, error)
Select many rows data from 'tb_group_chat' table by 'name'.
func SelectOneGroupChatById ¶
func SelectOneGroupChatById(id int64, isDelete bool) (*TableGroupChat, error)
Select one row data from 'tb_group_chat' table by 'id'.
func SelectOneGroupChatByNameAndManager ¶
func SelectOneGroupChatByNameAndManager(name string, managerId int64) (*TableGroupChat, error)
Select one row data from 'tb_group_chat' table by 'name' and 'manager_id', the tow field is an join unique index
type TableSubscription ¶
type TableSubscription struct { Id int64 `json:"id"` Name string `json:"name"` ManagerId int64 `json:"manager_id"` Intro string `json:"intro"` Avatar string `json:"avatar"` QrCode string `json:"qr_code"` IsDelete bool `json:"is_delete"` }
Subscription information in 'tb_subscription' table
func InsertOneNewSubscription ¶
func InsertOneNewSubscription(name, intro, avatar, qrCode string, managerId int64) (*TableSubscription, error)
Insert one row data into 'tb_subscription' table to save the information of one new subscription. 'id' will generated by SnowFlakeNode, 'is_delete' use default value 'false'.
func InsertOneNewSubscriptionPlus ¶
func InsertOneNewSubscriptionPlus(name, intro, avatar, qrCode string, managerId int64) (*TableSubscription, error)
Insert one new row data into 'tb_subscription' table with checking. It will check the user who will be the manager of the subscription if existed before insert the new row data into 'tb_subscription' table. Then will insert one row data into 'tb_user_subscription' table at the same time. Meaning the manager will always follow the subscription of himself, to know what the message sent from it at first time.
func SelectManySubscriptionByManagerId ¶
func SelectManySubscriptionByManagerId(managerId int64, isDelete bool) ([]*TableSubscription, error)
Select many rows data from 'tb_subscription' table by 'manager_id'.
func SelectOneSubscriptionById ¶
func SelectOneSubscriptionById(id int64, isDelete bool) (*TableSubscription, error)
Select one row data from 'tb_subscription' table by 'id'.
func SelectOneSubscriptionByName ¶
func SelectOneSubscriptionByName(name string, isDelete bool) (*TableSubscription, error)
Select one row data from 'tb_subscription' table by 'name', the 'name' is unique key.
type TableUserBasic ¶
type TableUserBasic struct { Id int64 `json:"id"` Email string `json:"email"` Name string `json:"name"` Password string `json:"password"` Mobile string `json:"mobile"` Gender int32 `json:"gender"` Avatar string `json:"avatar"` QrCode string `json:"qr_code"` IsDelete bool `json:"is_delete"` }
User basic information in `tb_user_basic` table. Because protocol buffer 3 only have int32, so 'Gender' also use int32 here.
func InsertOneNewUser ¶
func InsertOneNewUser(email, name, password, mobile string, gender int32, avatar, qrCode string, isDelete bool) (*TableUserBasic, error)
Insert one row new data for saving information of new user. The 'id' will auto generate by 'SnowFlakeNode', the 'is_delete' will use default value 'false'.
func SelectAllUsers ¶
func SelectAllUsers() ([]*TableUserBasic, error)
Select all rows data from 'tb_user_basic' table.
func SelectManyUserByName ¶
func SelectManyUserByName(name string, isDelete bool) ([]*TableUserBasic, error)
Select many rows data from 'tb_user_basic' table by 'name' and 'is_delete'.
func SelectOneUserByEmail ¶
func SelectOneUserByEmail(email string, isDelete bool) (*TableUserBasic, error)
Select one row data from 'tb_user_basic' table by 'email' and 'is_delete'.
func SelectOneUserById ¶
func SelectOneUserById(id int64, isDelete bool) (*TableUserBasic, error)
Select one row data from 'tb_user_basic' table by 'id' and 'is_delete'.
type TableUserGroupChat ¶
type TableUserGroupChat struct { GroupId int64 `json:"group_id"` UserId int64 `json:"user_id"` UserNote string `json:"user_note"` IsDelete bool `json:"is_delete"` }
User and group chat information in 'tb_user_group_chat'
func InsertOneNewUserGroupChat ¶
func InsertOneNewUserGroupChat(groupId, userId int64, userNote string) (*TableUserGroupChat, error)
Insert one new row data into 'tb_user_group_chat' table. If it is duplicated entry, will update the 'user_note' and 'is_delete'.
func SelectAllUserGroupChat ¶
func SelectAllUserGroupChat() ([]*TableUserGroupChat, error)
Select all rows data from 'tb_user_group_chat' table.
func SelectManyUserGroupChatByGroupId ¶
func SelectManyUserGroupChatByGroupId(groupId int64, isDelete bool) ([]*TableUserGroupChat, error)
Select many rows data from 'tb_user_group_chat' table by 'group_id' and 'is_delete'.
func SelectManyUserGroupChatByUserId ¶
func SelectManyUserGroupChatByUserId(userId int64, isDelete bool) ([]*TableUserGroupChat, error)
Select many rows data from 'tb_user_group_chat' table by 'user_id' and 'is_delete'.
func SelectOneUserGroupChat ¶
func SelectOneUserGroupChat(groupId, userId int64) (*TableUserGroupChat, error)
Select one row data from 'tb_user_group_chat' table by 'group_id' and 'user_id'
type TableUserSubscription ¶
type TableUserSubscription struct { SubsId int64 `json:"subs_id"` UserId int64 `json:"user_id"` IsDelete bool `json:"is_delete"` }
User and subscription information in 'tb_user_subscription' table.
func InsertOneNewUserSubscription ¶
func InsertOneNewUserSubscription(subsId, userId int64) (*TableUserSubscription, error)
Insert one new data into 'tb_user_subscription' table.
func SelectManyUserSubscriptionBySubsId ¶
func SelectManyUserSubscriptionBySubsId(subsId int64, isDelete bool) ([]*TableUserSubscription, error)
Select many rows data from 'tb_user_subscription' table by 'subs_id'.
func SelectManyUserSubscriptionByUserId ¶
func SelectManyUserSubscriptionByUserId(userId int64, isDelete bool) ([]*TableUserSubscription, error)
Select many rows data from 'tb_user_subscription' table by 'user_id'.
func SelectOneUserSubscription ¶
func SelectOneUserSubscription(subsId, userId int64) (*TableUserSubscription, error)
Select one row data from 'tb_user_subscription' table by 'subs_id' and 'user_id'