Documentation ¶
Index ¶
- Variables
- func Create(ctx context.Context, currentId int64, toUserId int64) error
- func Delete(ctx context.Context, currentId int64, toUserId int64) error
- func Init()
- func QueryRelationByIds(ctx context.Context, currentId int64, userIds []int64) (map[int64]*RelationRaw, error)
- type RelationRaw
- type UserRaw
Constants ¶
This section is empty.
Variables ¶
View Source
var DB *gorm.DB
Functions ¶
func QueryRelationByIds ¶
Types ¶
type RelationRaw ¶
type RelationRaw struct { gorm.Model UserId int64 `gorm:"column:user_id;not null;index:idx_userid"` ToUserId int64 `gorm:"column:to_user_id;not null;index:idx_touserid"` }
func QueryFollowById ¶
func QueryFollowById(ctx context.Context, userId int64) ([]*RelationRaw, error)
通过用户id,查询该用户关注的用户,返回两者之间的关注记录
func QueryFollowerById ¶
func QueryFollowerById(ctx context.Context, userId int64) ([]*RelationRaw, error)
通过用户id,查询该用户的粉丝, 返回两者之间的关注记录
func (RelationRaw) TableName ¶
func (RelationRaw) TableName() string
type UserRaw ¶
type UserRaw struct { gorm.Model Name string `gorm:"column:name;index:idx_username,unique;type:varchar(32);not null"` Password string `gorm:"column:password;type:varchar(32);not null"` FollowCount int64 `gorm:"column:follow_count;default:0"` FollowerCount int64 `gorm:"column:follower_count;default:0"` Avatar string `gorm:"column:avatar,type:varchar(100);not null"` // 用户头像 BackgroundImage string `gorm:"column:background_image,type:varchar(100);not null"` // 用户个人页顶部大图 Signature string `gorm:"column:signature,type:varchar(1000);not null"` // 个人简介 TotalFavorited string `gorm:"column:total_favorited;type:varchar(1000);not null"` // 获赞数量 WorkCount int64 `gorm:"column:work_count;default:0"` // 作品数量 FavoriteCount int64 `gorm:"column:favorite_count;default:0"` // 点赞数量 }
Click to show internal directories.
Click to hide internal directories.