cs

package
v0.4.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContactStatusRequesting int8 = iota + 1
	ContactStatusAgree
	ContactStatusReject
	ContactStatusDeleted
)
View Source
const (
	// 推文内容分快类型
	TweetBlockTitle TweetBlockType = iota + 1
	TweetBlockText
	TweetBlockImage
	TweetBlockVideo
	TweetBlockAudio
	TweetBlockLink
	TweetBlockAttachment
	TweetBlockChargeAttachment

	// 推文可见性
	TweetVisitPublic TweetVisibleType = iota
	TweetVisitPrivate
	TweetVisitFriend
	TweetVisitInvalid

	// 附件类型
	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 added in v0.4.0

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 added in v0.4.0

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

type AttachmentType added in v0.4.0

type AttachmentType int

AttachmentType 附件类型, 1图片, 2视频, 3其他 TODO: 优化一下类型为 uint8, 需要底层数据库同步修改

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 Contact added in v0.4.0

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 added in v0.4.0

type FavoriteItem struct {
	ID      int64      `json:"id"`
	Tweet   *TweetInfo `json:"-"`
	TweetID int64      `json:"post_id"`
	UserID  int64      `json:"user_id"`
}

Favorite 收藏

type FavoriteList added in v0.4.0

type FavoriteList []*FavoriteItem

FavoriteList 收藏列表

type NewTweetReq added in v0.4.0

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 added in v0.4.0

type ReactionItem struct {
	ID      int64      `json:"id"`
	Tweet   *TweetInfo `json:"-"`
	TweetID int64      `json:"post_id"`
	UserID  int64      `json:"user_id"`
}

Reaction 反应、表情符号, 点赞、喜欢等

type ReactionList added in v0.4.0

type ReactionList []*ReactionItem

ReactionList 点赞列表

type RelationTyp added in v0.4.0

type RelationTyp uint8
const (
	RelationUnknow RelationTyp = iota
	RelationSelf
	RelationFriend
	RelationFollower
	RelationFollowing
	RelationAdmin
	RelationGuest
)

func (RelationTyp) String added in v0.4.0

func (t RelationTyp) String() string

type TagInfo added in v0.4.0

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 added in v0.4.0

func (t *TagInfo) Format() *TagItem

type TagInfoList added in v0.4.0

type TagInfoList []*TagInfo

TagInfoList 标签信息列表

type TagItem added in v0.4.0

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 added in v0.4.0

type TagList []*TagItem

TagList 标签列表

type TagType added in v0.4.0

type TagType string

TagType 标签类型

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

type TsDocItem added in v0.4.0

type TsDocItem struct {
	Post    *TweetInfo
	Content string
}

TsDocItem 索引条陈

type TsDocList added in v0.4.0

type TsDocList []TsDocItem

TsDocList 索引条陈列表

type TsQueryReq added in v0.4.0

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

TsQueryReq 搜索查询请求

type TsQueryResp added in v0.4.0

type TsQueryResp struct {
	Items TweetList
	Total int64
}

TsQueryResp 搜索查询响应

type TsQueryType added in v0.4.0

type TsQueryType string

TsQueryType 搜索查询类型

const (
	// 搜索查询类型
	TsQueryTypeDefault TsQueryType = "search"
	TsQueryTypeTag     TsQueryType = "tag"
)

type TweetBlock added in v0.4.0

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 added in v0.4.0

type TweetBlockList []*TweetBlock

TweetBlockList 推文分块列表

type TweetBlockType added in v0.4.0

type TweetBlockType int

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

type TweetBox added in v0.4.0

type TweetBox struct {
	Tweets TweetList
	Total  int64
}

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

type TweetInfo added in v0.4.0

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 added in v0.4.0

type TweetInfoList []*TweetInfo

TweetInfoList 推文信息列表

type TweetItem added in v0.4.0

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 added in v0.4.0

type TweetList []*TweetItem

TweetList 推文列表

type TweetVisibleType added in v0.4.0

type TweetVisibleType uint8

TweetVisibleType 推文可见性,0公开,1私密,2好友

type UserInfo added in v0.4.0

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"`
}

UserInfo 用户基本信息

type UserInfoList added in v0.4.0

type UserInfoList []*UserInfo

UserInfoList 用户信息列表

type VistUser added in v0.4.0

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