cs

package
v0.0.0-...-85b3044 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

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 Attachment struct {
	ID        int64          `json:"id"`
	UserID    int64          `json:"user_id"`
	FileSize  int64          `json:"file_size"`
	ImgWidth  int            `json:"img_width"`
	ImgHeight int            `json:"img_height"`
	Type      AttachmentType `json:"type"`
	Content   string         `json:"content"`
}

type AttachmentBill

type AttachmentBill struct {
	ID         int64 `json:"id"`
	PostID     int64 `json:"post_id"`
	UserID     int64 `json:"user_id"`
	PaidAmount int64 `json:"paid_amount"`
}

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 CommentThumbs struct {
	UserID       int64 `json:"user_id"`
	TweetID      int64 `json:"tweet_id"`
	CommentID    int64 `json:"comment_id"`
	ReplyID      int64 `json:"reply_id"`
	CommentType  int8  `json:"comment_type"`
	IsThumbsUp   int8  `json:"is_thumbs_up"`
	IsThumbsDown int8  `json:"is_thumbs_down"`
}

type CommentThumbsList

type CommentThumbsList []*CommentThumbs

type CommentThumbsMap

type CommentThumbsMap map[int64]*CommentThumbs

type CommunityMetric

type CommunityMetric struct {
	CommunityId int64
	PostCount   int64
	MemberCount int64
}

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 FavoriteList

type FavoriteList []*FavoriteItem

FavoriteList 收藏列表

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 ReactionList

type ReactionList []*ReactionItem

ReactionList 点赞列表

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 标签信息

func (*TagInfo) Format

func (t *TagInfo) Format() *TagItem

type TagInfoList

type TagInfoList []*TagInfo

TagInfoList 标签信息列表

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 TagList

type TagList []*TagItem

TagList 标签列表

type TagType

type TagType string

TagType 标签类型

const (
	// 标签类型
	TagTypeHot       TagType = "hot"
	TagTypeNew       TagType = "new"
	TagTypeFollow    TagType = "follow"
	TagTypeHotExtral TagType = "hot_extral"
)

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 TsDocItem

type TsDocItem struct {
	Post    *TweetInfo
	Content string
}

TsDocItem 索引条陈

type TsDocList

type TsDocList []TsDocItem

TsDocList 索引条陈列表

type TsQueryReq

type TsQueryReq struct {
	Query      string
	Visibility []TweetVisibleType
	Type       TsQueryType
}

TsQueryReq 搜索查询请求

type TsQueryResp

type TsQueryResp struct {
	Items TweetList
	Total int64
}

TsQueryResp 搜索查询响应

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 TweetBlockList

type TweetBlockList []*TweetBlock

TweetBlockList 推文分块列表

type TweetBlockType

type TweetBlockType int

TweetBlockType 推文内容分块类型,1标题,2文字段落,3图片地址,4视频地址,5语音地址,6链接地址,7附件资源 TODO: 优化一下类型为 uint8, 需要底层数据库同步修改

type TweetBox

type TweetBox struct {
	Tweets TweetList
	Total  int64
}

TweetBox 推文列表盒子,包含其他一些关于推文列表的信息

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 TweetInfoList

type TweetInfoList []*TweetInfo

TweetInfoList 推文信息列表

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 TweetList

type TweetList []*TweetItem

TweetList 推文列表

type TweetMetric

type TweetMetric struct {
	PostId          int64
	CommentCount    int64
	UpvoteCount     int64
	CollectionCount int64
	ShareCount      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 UserInfoList

type UserInfoList []*UserInfo

UserInfoList 用户信息列表

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL