Documentation ¶
Index ¶
- func AcceptFriendApply(db *gorm.DB, applyID int64, userID int64, alias string) error
- func CreateFriendEntry(db *gorm.DB, selfID int64, friendID int64, alias string) error
- func DeleteFriendEntry(db *gorm.DB, entry *FriendEntry) error
- func DeleteFriendEntryBi(db *gorm.DB, userID1 int64, userID2 int64) error
- func DeleteFriendEntryByID(db *gorm.DB, entryID int64) error
- func DeleteUser(db *gorm.DB, userID int64) error
- func GetUserCount(db *gorm.DB) (int64, error)
- func RejectFriendApply(db *gorm.DB, applyID int64, userID int64) error
- type FriendApply
- func CreateFriendApply(db *gorm.DB, fromID int64, toID int64, alias string, remark string) (*FriendApply, error)
- func GetFriendApplyByID(db *gorm.DB, applyID int64) (*FriendApply, error)
- func GetFriendApplyFromByUserID(db *gorm.DB, userID int64) ([]FriendApply, error)
- func GetFriendApplyToByUserID(db *gorm.DB, userID int64) ([]FriendApply, error)
- func GetUncertainFriendApply(db *gorm.DB, fromID int64, toID int64) (*FriendApply, error)
- type FriendApplyState
- type FriendEntry
- type Meta
- type User
- func CreateUser(db *gorm.DB, user *User) (*User, error)
- func GetUserByID(db *gorm.DB, userID int64) (*User, error)
- func GetUserByMobile(db *gorm.DB, mobile string) (*User, error)
- func GetUserLikeNickName(db *gorm.DB, nickName string) ([]User, error)
- func GetUserLikeNickNameWithOffsetAndLimit(db *gorm.DB, nickName string, offset int64, limit int64) ([]User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AcceptFriendApply ¶
AcceptFriendApply 接受一个待确定的好友申请, alias 表示接受者给申请人的备注
func DeleteFriendEntry ¶
func DeleteFriendEntry(db *gorm.DB, entry *FriendEntry) error
DeleteFriendEntry 删除一个单项好友项目
func DeleteFriendEntryBi ¶
DeleteFriendEntryBi 双向删除好友
func DeleteFriendEntryByID ¶
DeleteFriendEntryByID 删除一个单项好友项目
Types ¶
type FriendApply ¶
type FriendApply struct { ID int64 `gorm:"primarykey" json:"id"` FromID int64 `gorm:"type:bigint not null;index:idx_from;" json:"from_id"` ToID int64 `gorm:"type:bigint not null;index:idx_to;" json:"to_id"` // Alias 表示申请人给接受者预设的备注 Alias string `gorm:"type:varChar(127) not null" json:"alias"` // Remark Remark string `gorm:"type:varChar(255) not null" json:"remark"` State FriendApplyState `gorm:"type:smallint not null;check:state >= -1 and state <= 1" json:"state"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt soft_delete.DeletedAt `gorm:"index" json:"deleted_at"` }
FriendApply 好友申请项的 dao
func CreateFriendApply ¶
func CreateFriendApply(db *gorm.DB, fromID int64, toID int64, alias string, remark string) (*FriendApply, error)
CreateFriendApply 创建一个新的待确定的好友申请 alias 表示发送者给接受者的预设备注
func GetFriendApplyByID ¶
func GetFriendApplyByID(db *gorm.DB, applyID int64) (*FriendApply, error)
GetFriendApplyByID 根据 id 获取好友申请
func GetFriendApplyFromByUserID ¶
func GetFriendApplyFromByUserID(db *gorm.DB, userID int64) ([]FriendApply, error)
GetFriendApplyFromByUserID 获得用户自己发送的好友申请列表
func GetFriendApplyToByUserID ¶
func GetFriendApplyToByUserID(db *gorm.DB, userID int64) ([]FriendApply, error)
GetFriendApplyToByUserID 获得用户收到的好友申请列表
func GetUncertainFriendApply ¶
GetUncertainFriendApply 获取一个待确定的好友申请
type FriendApplyState ¶
type FriendApplyState int64
const ( StateReject FriendApplyState = -1 StateUncertain FriendApplyState = 0 StateAccept FriendApplyState = 1 )
type FriendEntry ¶
type FriendEntry struct { ID int64 `gorm:"primarykey" json:"id"` SelfID int64 `gorm:"uniqueIndex:idx_composited_id;index:idx_self" json:"self_id"` FriendID int64 `gorm:"uniqueIndex:idx_composited_id;index:idx_friend" json:"friend_id"` Alias string `gorm:"type:varChar(127) not null" json:"alias"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt soft_delete.DeletedAt `gorm:"uniqueIndex:idx_composited_id" json:"deleted_at"` }
FriendEntry 好友列表项的 dao
func GetFriendEntry ¶
GetFriendEntry 查找两个好友
func GetFriendEntrySelfByUserID ¶
func GetFriendEntrySelfByUserID(db *gorm.DB, userID int64) ([]FriendEntry, error)
GetFriendEntrySelfByUserID 获得用户自己的好友列表
func ModifyFriendEntryAlias ¶
func ModifyFriendEntryAlias(db *gorm.DB, selfID int64, friendID int64, newAlias string) (*FriendEntry, error)
ModifyFriendEntryAlias 修改好友备注名
type User ¶
type User struct { ID int64 `gorm:"primarykey" json:"id"` NickName string `gorm:"type:varChar(255) not null" json:"nickname"` Email string `gorm:"type:varChar(255) not null" json:"email"` Mobile string `gorm:"type:varChar(31) not null;uniqueIndex:idx_mobile" json:"mobile"` Avatar string `gorm:"type:varChar(255) not null" json:"avatar"` Bio string `gorm:"type:text not null" json:"bio"` Password string `gorm:"type:text not null" json:"-"` AllowSearchByName bool `gorm:"type:boolean not null;default:true" json:"allow_search_by_name"` AllowShowPhone bool `gorm:"type:boolean not null;default:true" json:"allow_show_phone"` AllowSearchByPhone bool `gorm:"type:boolean not null;default:true" json:"allow_search_by_phone"` Meta // 好友列表项(自己拥有的好友) FriendEntrySelf []FriendEntry `gorm:"foreignKey:SelfID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"-"` // 好友列表项(自己作为其他人的好友) FriendEntryFriend []FriendEntry `gorm:"foreignKey:FriendID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"-"` // 好友申请项(自己发出) FriendApplyFrom []FriendApply `gorm:"foreignKey:FromID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"-"` // 好友申请项(自己接收) FriendApplyTo []FriendApply `gorm:"foreignKey:ToID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"-"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt soft_delete.DeletedAt `gorm:"uniqueIndex:idx_mobile" json:"deleted_at"` }
User 用户的 dao
func GetUserLikeNickName ¶
GetUserLikeNickName 根据模糊搜索寻找用户
Click to show internal directories.
Click to hide internal directories.