Documentation ¶
Index ¶
- Constants
- Variables
- type Attachment
- type AttachmentBill
- type AttachmentType
- type CommentMetric
- type CommentThumbs
- type CommentThumbsList
- type CommentThumbsMap
- type CommunityMetric
- type Contact
- type FavoriteItem
- type FavoriteList
- type MessageStyle
- type NewTweetReq
- type ReactionItem
- type ReactionList
- type RelationTyp
- type StyleCommentType
- type TagInfo
- type TagInfoList
- type TagItem
- type TagList
- type TagType
- type TrendsItem
- type TsDocItem
- type TsDocList
- type TsQueryReq
- type TsQueryResp
- type TsQueryType
- type TweetBlock
- type TweetBlockList
- type TweetBlockType
- type TweetBox
- type TweetInfo
- type TweetInfoList
- type TweetItem
- type TweetList
- type TweetMetric
- type TweetVisibleType
- type UserInfo
- type UserInfoList
- type UserProfile
- type VistUser
Constants ¶
View Source
const ( ContactStatusRequesting int8 = iota + 1 ContactStatusAgree ContactStatusReject ContactStatusDeleted )
View Source
const ( MetricActionCreateTweet uint8 = iota MetricActionDeleteTweet )
View Source
const ( // 推文内容分快类型 TweetBlockTitle TweetBlockType = iota + 1 TweetBlockText TweetBlockImage TweetBlockVideo TweetBlockAudio TweetBlockLink TweetBlockAttachment TweetBlockChargeAttachment // 推文可见性 TweetVisitPublic TweetVisibleType = 90 TweetVisitPrivate TweetVisibleType = 0 TweetVisitFriend TweetVisibleType = 50 TweetVisitFollowing TweetVisibleType = 60 // 用户推文列表样式 StyleUserTweetsGuest uint8 = iota StyleUserTweetsSelf StyleUserTweetsAdmin StyleUserTweetsFriend StyleUserTweetsFollowing // 附件类型 AttachmentTypeImage AttachmentType = iota + 1 AttachmentTypeVideo AttachmentTypeOther )
Variables ¶
View Source
var ( ErrNotImplemented = errors.New("not implemented") ErrNoPermission = errors.New("no permission") )
internal core error variable for data logic implement.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type AttachmentBill ¶
type AttachmentType ¶
type AttachmentType int
AttachmentType 附件类型, 1图片, 2视频, 3其他 TODO: 优化一下类型为 uint8, 需要底层数据库同步修改
type CommentMetric ¶
type CommentMetric struct { CommentId int64 ReplyCount int32 ThumbsUpCount int32 ThumbsDownCount int32 }
func (*CommentMetric) RankScore ¶
func (m *CommentMetric) RankScore(motivationFactor int) int64
type CommentThumbs ¶
type CommentThumbsList ¶
type CommentThumbsList []*CommentThumbs
type CommentThumbsMap ¶
type CommentThumbsMap map[int64]*CommentThumbs
type CommunityMetric ¶
type Contact ¶
type Contact struct { ID int64 `db:"id" json:"id"` UserId int64 `db:"user_id" json:"user_id"` FriendId int64 `db:"friend_id" json:"friend_id"` GroupId int64 `json:"group_id"` Remark string `json:"remark"` Status int8 `json:"status"` // 1请求好友, 2已同意好友, 3已拒绝好友, 4已删除好友 IsTop int8 `json:"is_top"` IsBlack int8 `json:"is_black"` NoticeEnable int8 `json:"notice_enable"` IsDel int8 `json:"-"` DeletedOn int64 `db:"-" json:"-"` }
type FavoriteItem ¶
type FavoriteItem struct { ID int64 `json:"id"` Tweet *TweetInfo `json:"-"` TweetID int64 `json:"post_id"` UserID int64 `json:"user_id"` }
Favorite 收藏
type MessageStyle ¶
type MessageStyle string
const ( // 消息列表样式 StyleMsgAll MessageStyle = "all" StyleMsgSystem MessageStyle = "system" StyleMsgWhisper MessageStyle = "whisper" StyleMsgRequesting MessageStyle = "requesting" StyleMsgUnread MessageStyle = "unread" )
type NewTweetReq ¶
type NewTweetReq struct { Contents TweetBlockList `json:"contents" binding:"required"` Tags []string `json:"tags" binding:"required"` Users []string `json:"users" binding:"required"` AttachmentPrice int64 `json:"attachment_price"` Visibility TweetVisibleType `json:"visibility"` ClientIP string `json:"-" binding:"-"` }
type ReactionItem ¶
type ReactionItem struct { ID int64 `json:"id"` Tweet *TweetInfo `json:"-"` TweetID int64 `json:"post_id"` UserID int64 `json:"user_id"` }
Reaction 反应、表情符号, 点赞、喜欢等
type RelationTyp ¶
type RelationTyp uint8
const ( RelationUnknown RelationTyp = iota RelationSelf RelationFriend RelationFollower RelationFollowing RelationAdmin RelationGuest )
func (RelationTyp) String ¶
func (t RelationTyp) String() string
type StyleCommentType ¶
type StyleCommentType uint8
const ( StyleCommentDefault StyleCommentType = iota StyleCommentHots StyleCommentNewest )
type TagInfo ¶
type TagInfo struct { ID int64 `json:"id" db:"id"` UserID int64 `json:"user_id" db:"user_id"` Tag string `json:"tag"` QuoteNum int64 `json:"quote_num" db:"quote_num"` }
TagInfo 标签信息
type TagItem ¶
type TagItem struct { ID int64 `json:"id"` UserID int64 `json:"user_id"` User *UserInfo `json:"user" db:"u"` Tag string `json:"tag"` QuoteNum int64 `json:"quote_num"` IsFollowing int8 `json:"is_following"` IsTop int8 `json:"is_top"` }
TagItem 标签信息条陈
type TrendsItem ¶
type TrendsItem struct { Username string `json:"username"` Nickname string `json:"nickname"` Avatar string `json:"avatar"` IsFresh bool `json:"is_fresh" gorm:"-"` }
func DistinctTrends ¶
func DistinctTrends(items []*TrendsItem) []*TrendsItem
type TsQueryReq ¶
type TsQueryReq struct { Query string Visibility []TweetVisibleType Type TsQueryType }
TsQueryReq 搜索查询请求
type TsQueryType ¶
type TsQueryType string
TsQueryType 搜索查询类型
const ( // 搜索查询类型 TsQueryTypeDefault TsQueryType = "search" TsQueryTypeTag TsQueryType = "tag" )
type TweetBlock ¶
type TweetBlock struct { ID int64 `json:"id" binding:"-"` PostID int64 `json:"post_id" binding:"-"` Content string `json:"content" binding:"required"` Type TweetBlockType `json:"type" binding:"required"` Sort int64 `json:"sort" binding:"required"` }
TweetBlock 推文分块
type TweetBlockType ¶
type TweetBlockType int
TweetBlockType 推文内容分块类型,1标题,2文字段落,3图片地址,4视频地址,5语音地址,6链接地址,7附件资源 TODO: 优化一下类型为 uint8, 需要底层数据库同步修改
type TweetInfo ¶
type TweetInfo struct { ID int64 `json:"id"` UserID int64 `json:"user_id"` CommentCount int64 `json:"comment_count"` CollectionCount int64 `json:"collection_count"` UpvoteCount int64 `json:"upvote_count"` Visibility TweetVisibleType `json:"visibility"` IsTop int `json:"is_top"` IsEssence int `json:"is_essence"` IsLock int `json:"is_lock"` LatestRepliedOn int64 `json:"latest_replied_on"` Tags string `json:"tags"` AttachmentPrice int64 `json:"attachment_price"` IP string `json:"ip"` IPLoc string `json:"ip_loc"` CreatedOn int64 `json:"created_on"` ModifiedOn int64 `json:"modified_on"` }
TweetInfo 推文信息
type TweetItem ¶
type TweetItem struct { ID int64 `json:"id"` UserID int64 `json:"user_id"` User *UserInfo `db:"user" json:"user"` Contents []*TweetBlock `db:"-" json:"contents"` CommentCount int64 `json:"comment_count"` CollectionCount int64 `json:"collection_count"` UpvoteCount int64 `json:"upvote_count"` Visibility TweetVisibleType `json:"visibility"` IsTop int `json:"is_top"` IsEssence int `json:"is_essence"` IsLock int `json:"is_lock"` LatestRepliedOn int64 `json:"latest_replied_on"` CreatedOn int64 `json:"created_on"` ModifiedOn int64 `json:"modified_on"` Tags map[string]int8 `json:"tags"` AttachmentPrice int64 `json:"attachment_price"` IPLoc string `json:"ip_loc"` }
TweetItem 一条推文信息
type TweetMetric ¶
type TweetMetric struct { PostId int64 CommentCount int64 UpvoteCount int64 CollectionCount int64 ThumbsUpCount int64 ThumbsDownCount int64 }
func (*TweetMetric) RankScore ¶
func (m *TweetMetric) RankScore(motivationFactor int) int64
type TweetVisibleType ¶
type TweetVisibleType uint8
TweetVisibleType 推文可见性: 0私密 10充电可见 20订阅可见 30保留 40保留 50好友可见 60关注可见 70保留 80保留 90公开',
func (TweetVisibleType) ToOutValue ¶
func (t TweetVisibleType) ToOutValue() (res uint8)
type UserInfo ¶
type UserInfo struct { ID int64 `json:"id"` Nickname string `json:"nickname"` Username string `json:"username"` Status int `json:"status"` Avatar string `json:"avatar"` IsAdmin bool `json:"is_admin"` CreatedOn int64 `json:"created_on"` }
UserInfo 用户基本信息
type UserProfile ¶
type UserProfile struct { ID int64 `json:"id" db:"id"` Nickname string `json:"nickname"` Username string `json:"username"` Phone string `json:"phone"` Status int `json:"status"` Avatar string `json:"avatar"` Balance int64 `json:"balance"` IsAdmin bool `json:"is_admin"` CreatedOn int64 `json:"created_on"` TweetsCount int `json:"tweets_count"` }
type VistUser ¶
type VistUser struct { Username string UserId int64 RelTyp RelationTyp }
Click to show internal directories.
Click to hide internal directories.