Documentation ¶
Index ¶
- Constants
- type Attachment
- type AttachmentType
- type Captcha
- type Comment
- func (c *Comment) CommentIdsByPostId(db *gorm.DB, postId int64) (ids []int64, err error)
- func (c *Comment) Count(db *gorm.DB, conditions *ConditionsT) (int64, error)
- func (c *Comment) Create(db *gorm.DB) (*Comment, error)
- func (c *Comment) Delete(db *gorm.DB) error
- func (c *Comment) DeleteByPostId(db *gorm.DB, postId int64) error
- func (c *Comment) Format() *CommentFormated
- func (c *Comment) Get(db *gorm.DB) (*Comment, error)
- func (c *Comment) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) ([]*Comment, error)
- type CommentContent
- func (c *CommentContent) Create(db *gorm.DB) (*CommentContent, error)
- func (c *CommentContent) DeleteByCommentIds(db *gorm.DB, commentIds []int64) error
- func (c *CommentContent) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) ([]*CommentContent, error)
- func (c *CommentContent) MediaContentsByCommentId(db *gorm.DB, commentIds []int64) (contents []string, err error)
- type CommentFormated
- type CommentMetric
- type CommentReply
- func (c *CommentReply) Create(db *gorm.DB) (*CommentReply, error)
- func (c *CommentReply) Delete(db *gorm.DB) error
- func (c *CommentReply) DeleteByCommentIds(db *gorm.DB, commentIds []int64) error
- func (c *CommentReply) Format() *CommentReplyFormated
- func (c *CommentReply) Get(db *gorm.DB) (*CommentReply, error)
- func (c *CommentReply) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) ([]*CommentReply, error)
- type CommentReplyFormated
- type ConditionsT
- type Contact
- func (c *Contact) BeFriendIds(db *gorm.DB) (ids []int64, err error)
- func (m *Contact) Count(db *gorm.DB, conditions ConditionsT) (int64, error)
- func (c *Contact) Create(db *gorm.DB) (*Contact, error)
- func (c *Contact) FetchByUserFriendAll(db *gorm.DB) ([]*Contact, error)
- func (c *Contact) FetchUser(db *gorm.DB) (*Contact, error)
- func (c *Contact) GetByUserFriend(db *gorm.DB) (*Contact, error)
- func (c *Contact) List(db *gorm.DB, conditions ConditionsT, offset, limit int) ([]*Contact, error)
- func (c *Contact) MyFriendIds(db *gorm.DB) (ids []string, err error)
- func (c *Contact) Update(db *gorm.DB) error
- func (c *Contact) UpdateInUnscoped(db *gorm.DB) error
- type Following
- func (f *Following) Create(db *gorm.DB) (*Following, error)
- func (f *Following) DelFollowing(db *gorm.DB, userId, followId int64) error
- func (f *Following) FollowCount(db *gorm.DB, userId int64) (follows int64, followings int64, err error)
- func (f *Following) GetFollowing(db *gorm.DB, userId, followId int64) (*Following, error)
- func (s *Following) IsFollow(db *gorm.DB, userId int64, followId int64) bool
- func (f *Following) ListFollowingIds(db *gorm.DB, userId int64, limit, offset int) (ids []int64, total int64, err error)
- func (f *Following) ListFollows(db *gorm.DB, userId int64, limit int, offset int) (res []*Following, total int64, err error)
- func (c *Following) UpdateInUnscoped(db *gorm.DB) error
- type Message
- func (m *Message) Count(db *gorm.DB, userId int64) (res int64, err error)
- func (m *Message) CountUnread(db *gorm.DB, userId int64) (res int64, err error)
- func (m *Message) Create(db *gorm.DB) (*Message, error)
- func (m *Message) FetchBy(db *gorm.DB, predicates Predicates) ([]*Message, error)
- func (m *Message) Format() *MessageFormated
- func (m *Message) Get(db *gorm.DB) (*Message, error)
- func (c *Message) List(db *gorm.DB, userId int64, offset, limit int) (res []*Message, err error)
- func (m *Message) Update(db *gorm.DB) error
- type MessageFormated
- type MessageT
- type Model
- type Post
- func (p *Post) Count(db *gorm.DB, conditions ConditionsT) (int64, error)
- func (p *Post) CountBy(db *gorm.DB, predicates Predicates) (count int64, err error)
- func (p *Post) Create(db *gorm.DB) (*Post, error)
- func (s *Post) Delete(db *gorm.DB) error
- func (p *Post) Fetch(db *gorm.DB, predicates Predicates, offset, limit int) ([]*Post, error)
- func (p *Post) Format() *PostFormated
- func (p *Post) Get(db *gorm.DB) (*Post, error)
- func (p *Post) List(db *gorm.DB, conditions ConditionsT, offset, limit int) ([]*Post, error)
- func (p *Post) Update(db *gorm.DB) error
- type PostAttachmentBill
- type PostByComment
- type PostByMedia
- type PostCollection
- func (p *PostCollection) Count(db *gorm.DB, conditions *ConditionsT) (int64, error)
- func (p *PostCollection) Create(db *gorm.DB) (*PostCollection, error)
- func (p *PostCollection) Delete(db *gorm.DB) error
- func (p *PostCollection) Get(db *gorm.DB) (*PostCollection, error)
- func (p *PostCollection) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) ([]*PostCollection, error)
- type PostContent
- func (p *PostContent) Create(db *gorm.DB) (*PostContent, error)
- func (p *PostContent) DeleteByPostId(db *gorm.DB, postId int64) error
- func (p *PostContent) Format() *PostContentFormated
- func (p *PostContent) Get(db *gorm.DB) (*PostContent, error)
- func (p *PostContent) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) ([]*PostContent, error)
- func (p *PostContent) MediaContentsByPostId(db *gorm.DB, postId int64) (contents []string, err error)
- type PostContentFormated
- type PostContentT
- type PostFormated
- type PostMetric
- type PostStar
- func (p *PostStar) Count(db *gorm.DB, typ cs.RelationTyp, conditions *ConditionsT) (res int64, err error)
- func (p *PostStar) Create(db *gorm.DB) (*PostStar, error)
- func (p *PostStar) Delete(db *gorm.DB) error
- func (p *PostStar) Get(db *gorm.DB) (*PostStar, error)
- func (p *PostStar) List(db *gorm.DB, conditions *ConditionsT, typ cs.RelationTyp, limit int, ...) (res []*PostStar, err error)
- type PostVisibleT
- type Predicates
- type Tag
- func (t *Tag) Create(db *gorm.DB) (*Tag, error)
- func (t *Tag) Delete(db *gorm.DB) error
- func (t *Tag) Format() *TagFormated
- func (t *Tag) Get(db *gorm.DB) (*Tag, error)
- func (t *Tag) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) (tags []*Tag, err error)
- func (t *Tag) TagsFrom(db *gorm.DB, tags []string) (res []*Tag, err error)
- func (t *Tag) Update(db *gorm.DB) error
- type TagFormated
- type TopicUser
- type TweetCommentThumbs
- type User
- func (u *User) Create(db *gorm.DB) (*User, error)
- func (u *User) Format() *UserFormated
- func (u *User) Get(db *gorm.DB) (*User, error)
- func (u *User) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) ([]*User, error)
- func (u *User) ListUserInfoById(db *gorm.DB, ids []int64) (res cs.UserInfoList, err error)
- func (u *User) Update(db *gorm.DB) error
- type UserFormated
- type UserMetric
- type WalletRecharge
- type WalletStatement
- func (w *WalletStatement) Count(db *gorm.DB, conditions *ConditionsT) (int64, error)
- func (w *WalletStatement) Create(db *gorm.DB) (*WalletStatement, error)
- func (w *WalletStatement) Get(db *gorm.DB) (*WalletStatement, error)
- func (w *WalletStatement) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) ([]*WalletStatement, error)
Constants ¶
View Source
const ( ContactStatusRequesting int8 = iota + 1 ContactStatusAgree ContactStatusReject ContactStatusDeleted )
View Source
const ( UserStatusNormal int = iota + 1 UserStatusClosed )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment struct { *Model 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"` }
func (*Attachment) Create ¶
func (a *Attachment) Create(db *gorm.DB) (*Attachment, error)
type AttachmentType ¶
type AttachmentType int
const ( AttachmentTypeImage AttachmentType = iota + 1 AttachmentTypeVideo AttachmentTypeOther )
type Captcha ¶
type Comment ¶
type Comment struct { *Model PostID int64 `json:"post_id"` UserID int64 `json:"user_id"` IP string `json:"ip"` IPLoc string `json:"ip_loc"` IsEssence int8 `json:"is_essense"` ReplyCount int32 `json:"reply_count"` ThumbsUpCount int32 `json:"thumbs_up_count"` ThumbsDownCount int32 `json:"-"` }
func (*Comment) CommentIdsByPostId ¶
func (*Comment) Format ¶
func (c *Comment) Format() *CommentFormated
type CommentContent ¶
type CommentContent struct { *Model CommentID int64 `json:"comment_id"` UserID int64 `json:"user_id"` Content string `json:"content"` Type PostContentT `json:"type"` Sort int64 `json:"sort"` }
func (*CommentContent) Create ¶
func (c *CommentContent) Create(db *gorm.DB) (*CommentContent, error)
func (*CommentContent) DeleteByCommentIds ¶
func (c *CommentContent) DeleteByCommentIds(db *gorm.DB, commentIds []int64) error
func (*CommentContent) List ¶
func (c *CommentContent) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) ([]*CommentContent, error)
func (*CommentContent) MediaContentsByCommentId ¶
type CommentFormated ¶
type CommentFormated struct { ID int64 `json:"id"` PostID int64 `json:"post_id"` UserID int64 `json:"user_id"` User *UserFormated `json:"user"` Contents []*CommentContent `json:"contents"` Replies []*CommentReplyFormated `json:"replies"` IPLoc string `json:"ip_loc"` ReplyCount int32 `json:"reply_count"` ThumbsUpCount int32 `json:"thumbs_up_count"` IsEssence int8 `json:"is_essence"` IsThumbsUp int8 `json:"is_thumbs_up"` IsThumbsDown int8 `json:"is_thumbs_down"` CreatedOn int64 `json:"created_on"` ModifiedOn int64 `json:"modified_on"` }
type CommentMetric ¶ added in v0.5.0
type CommentMetric struct { *Model CommentId int64 RankScore int64 IncentiveScore int DecayFactor int MotivationFactor int }
func (*CommentMetric) Create ¶ added in v0.5.0
func (m *CommentMetric) Create(db *gorm.DB) (*CommentMetric, error)
type CommentReply ¶
type CommentReply struct { *Model CommentID int64 `db:"comment_id" json:"comment_id"` UserID int64 `db:"user_id" json:"user_id"` AtUserID int64 `db:"at_user_id" json:"at_user_id"` Content string `json:"content"` IP string `json:"ip"` IPLoc string `json:"ip_loc"` ThumbsUpCount int32 `json:"thumbs_up_count"` ThumbsDownCount int32 `json:"-"` }
func (*CommentReply) Create ¶
func (c *CommentReply) Create(db *gorm.DB) (*CommentReply, error)
func (*CommentReply) DeleteByCommentIds ¶
func (c *CommentReply) DeleteByCommentIds(db *gorm.DB, commentIds []int64) error
func (*CommentReply) Format ¶
func (c *CommentReply) Format() *CommentReplyFormated
func (*CommentReply) Get ¶
func (c *CommentReply) Get(db *gorm.DB) (*CommentReply, error)
func (*CommentReply) List ¶
func (c *CommentReply) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) ([]*CommentReply, error)
type CommentReplyFormated ¶
type CommentReplyFormated struct { ID int64 `json:"id"` CommentID int64 `db:"comment_id" json:"comment_id"` UserID int64 `db:"user_id" json:"user_id"` User *UserFormated `json:"user"` AtUserID int64 `db:"at_user_id" json:"at_user_id"` AtUser *UserFormated `json:"at_user"` Content string `json:"content"` IPLoc string `json:"ip_loc"` ThumbsUpCount int32 `json:"thumbs_up_count"` IsThumbsUp int8 `json:"is_thumbs_up"` IsThumbsDown int8 `json:"is_thumbs_down"` CreatedOn int64 `json:"created_on"` ModifiedOn int64 `json:"modified_on"` }
type ConditionsT ¶
type Contact ¶
type Contact struct { *Model User *User `json:"-" gorm:"foreignKey:ID;references:FriendId"` UserId int64 `json:"user_id"` FriendId int64 `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"` }
func (*Contact) FetchByUserFriendAll ¶
type Following ¶ added in v0.4.0
type Following struct { *Model User *User `json:"-" gorm:"foreignKey:ID;references:FollowId"` UserId int64 `json:"user_id"` FollowId int64 `json:"friend_id"` }
func (*Following) DelFollowing ¶ added in v0.4.0
func (*Following) FollowCount ¶ added in v0.4.0
func (*Following) GetFollowing ¶ added in v0.4.0
func (*Following) ListFollowingIds ¶ added in v0.4.0
func (*Following) ListFollows ¶ added in v0.4.0
type Message ¶
type Message struct { *Model SenderUserID int64 `json:"sender_user_id"` ReceiverUserID int64 `json:"receiver_user_id"` Type MessageT `json:"type"` Brief string `json:"brief"` Content string `json:"content"` PostID int64 `json:"post_id"` CommentID int64 `json:"comment_id"` ReplyID int64 `json:"reply_id"` IsRead int8 `json:"is_read"` }
func (*Message) CountUnread ¶ added in v0.5.0
func (*Message) Format ¶
func (m *Message) Format() *MessageFormated
type MessageFormated ¶
type MessageFormated struct { ID int64 `json:"id"` SenderUserID int64 `json:"sender_user_id"` SenderUser *UserFormated `json:"sender_user"` ReceiverUserID int64 `json:"receiver_user_id"` ReceiverUser *UserFormated `json:"receiver_user,omitempty"` Type MessageT `json:"type"` Brief string `json:"brief"` Content string `json:"content"` PostID int64 `json:"post_id"` Post *PostFormated `json:"post"` CommentID int64 `json:"comment_id"` Comment *Comment `json:"comment"` ReplyID int64 `json:"reply_id"` Reply *CommentReply `json:"reply"` IsRead int8 `json:"is_read"` CreatedOn int64 `json:"created_on"` ModifiedOn int64 `json:"modified_on"` }
type Model ¶
type Model struct { ID int64 `gorm:"primary_key" json:"id"` CreatedOn int64 `json:"created_on"` ModifiedOn int64 `json:"modified_on"` DeletedOn int64 `json:"deleted_on"` IsDel soft_delete.DeletedAt `gorm:"softDelete:flag" json:"is_del"` }
Model 公共Model
type Post ¶
type Post struct { *Model UserID int64 `json:"user_id"` CommentCount int64 `json:"comment_count"` CollectionCount int64 `json:"collection_count"` UpvoteCount int64 `json:"upvote_count"` Visibility PostVisibleT `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"` }
func (*Post) Format ¶
func (p *Post) Format() *PostFormated
type PostAttachmentBill ¶
type PostAttachmentBill struct { *Model PostID int64 `json:"post_id"` UserID int64 `json:"user_id"` PaidAmount int64 `json:"paid_amount"` }
func (*PostAttachmentBill) Create ¶
func (p *PostAttachmentBill) Create(db *gorm.DB) (*PostAttachmentBill, error)
func (*PostAttachmentBill) Get ¶
func (p *PostAttachmentBill) Get(db *gorm.DB) (*PostAttachmentBill, error)
type PostByComment ¶ added in v0.4.0
type PostByComment = Post
type PostByMedia ¶ added in v0.4.0
type PostByMedia = Post
type PostCollection ¶
type PostCollection struct { *Model Post *Post `json:"-"` PostID int64 `db:"post_id" json:"post_id"` UserID int64 `db:"user_id" json:"user_id"` }
func (*PostCollection) Count ¶
func (p *PostCollection) Count(db *gorm.DB, conditions *ConditionsT) (int64, error)
func (*PostCollection) Create ¶
func (p *PostCollection) Create(db *gorm.DB) (*PostCollection, error)
func (*PostCollection) Get ¶
func (p *PostCollection) Get(db *gorm.DB) (*PostCollection, error)
func (*PostCollection) List ¶
func (p *PostCollection) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) ([]*PostCollection, error)
type PostContent ¶
type PostContent struct { *Model PostID int64 `json:"post_id"` UserID int64 `json:"user_id"` Content string `json:"content"` Type PostContentT `json:"type"` Sort int64 `json:"sort"` }
func (*PostContent) Create ¶
func (p *PostContent) Create(db *gorm.DB) (*PostContent, error)
func (*PostContent) DeleteByPostId ¶
func (p *PostContent) DeleteByPostId(db *gorm.DB, postId int64) error
func (*PostContent) Format ¶
func (p *PostContent) Format() *PostContentFormated
func (*PostContent) Get ¶
func (p *PostContent) Get(db *gorm.DB) (*PostContent, error)
func (*PostContent) List ¶
func (p *PostContent) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) ([]*PostContent, error)
func (*PostContent) MediaContentsByPostId ¶
type PostContentFormated ¶
type PostContentFormated struct { ID int64 `db:"id" json:"id"` PostID int64 `json:"post_id"` Content string `json:"content"` Type PostContentT `json:"type"` Sort int64 `json:"sort"` }
type PostContentT ¶
type PostContentT int
类型,1标题,2文字段落,3图片地址,4视频地址,5语音地址,6链接地址,7附件资源
const ( ContentTypeTitle PostContentT = iota + 1 ContentTypeText ContentTypeImage ContentTypeVideo ContentTypeAudio ContentTypeLink ContentTypeAttachment ContentTypeChargeAttachment )
type PostFormated ¶
type PostFormated struct { ID int64 `json:"id"` UserID int64 `json:"user_id"` User *UserFormated `json:"user"` Contents []*PostContentFormated `json:"contents"` CommentCount int64 `json:"comment_count"` CollectionCount int64 `json:"collection_count"` UpvoteCount int64 `json:"upvote_count"` Visibility PostVisibleT `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"` }
type PostMetric ¶ added in v0.5.0
type PostMetric struct { *Model PostId int64 RankScore int64 IncentiveScore int DecayFactor int MotivationFactor int }
func (*PostMetric) Create ¶ added in v0.5.0
func (m *PostMetric) Create(db *gorm.DB) (*PostMetric, error)
type PostStar ¶
type PostStar struct { *Model Post *Post `json:"-"` PostID int64 `json:"post_id"` UserID int64 `json:"user_id"` }
func (*PostStar) Count ¶
func (p *PostStar) Count(db *gorm.DB, typ cs.RelationTyp, conditions *ConditionsT) (res int64, err error)
type PostVisibleT ¶
type PostVisibleT uint8
PostVisibleT 可访问类型,可见性: 0私密 10充电可见 20订阅可见 30保留 40保留 50好友可见 60关注可见 70保留 80保留 90公开',
const ( PostVisitPublic PostVisibleT = 90 PostVisitPrivate PostVisibleT = 0 PostVisitFriend PostVisibleT = 50 PostVisitFollowing PostVisibleT = 60 )
func (PostVisibleT) String ¶
func (p PostVisibleT) String() string
func (PostVisibleT) ToOutValue ¶ added in v0.5.0
func (t PostVisibleT) ToOutValue() (res uint8)
type Predicates ¶
type Tag ¶
type Tag struct { *Model UserID int64 `json:"user_id"` Tag string `json:"tag"` QuoteNum int64 `json:"quote_num"` }
func (*Tag) Format ¶
func (t *Tag) Format() *TagFormated
type TagFormated ¶
type TweetCommentThumbs ¶ added in v0.3.0
type User ¶
type User struct { *Model Nickname string `json:"nickname"` Username string `json:"username"` Phone string `json:"phone"` Password string `json:"password"` Salt string `json:"salt"` Status int `json:"status"` Avatar string `json:"avatar"` Balance int64 `json:"balance"` IsAdmin bool `json:"is_admin"` }
func (*User) Format ¶
func (u *User) Format() *UserFormated
func (*User) ListUserInfoById ¶ added in v0.4.0
type UserFormated ¶
type UserMetric ¶ added in v0.5.0
func (*UserMetric) Create ¶ added in v0.5.0
func (m *UserMetric) Create(db *gorm.DB) (*UserMetric, error)
type WalletRecharge ¶
type WalletRecharge struct { *Model UserID int64 `json:"user_id"` Amount int64 `json:"amount"` TradeNo string `json:"trade_no"` TradeStatus string `json:"trade_status"` }
func (*WalletRecharge) Create ¶
func (p *WalletRecharge) Create(db *gorm.DB) (*WalletRecharge, error)
func (*WalletRecharge) Get ¶
func (p *WalletRecharge) Get(db *gorm.DB) (*WalletRecharge, error)
type WalletStatement ¶
type WalletStatement struct { *Model UserID int64 `json:"user_id"` ChangeAmount int64 `json:"change_amount"` BalanceSnapshot int64 `json:"balance_snapshot"` Reason string `json:"reason"` PostID int64 `json:"post_id"` }
func (*WalletStatement) Count ¶
func (w *WalletStatement) Count(db *gorm.DB, conditions *ConditionsT) (int64, error)
func (*WalletStatement) Create ¶
func (w *WalletStatement) Create(db *gorm.DB) (*WalletStatement, error)
func (*WalletStatement) Get ¶
func (w *WalletStatement) Get(db *gorm.DB) (*WalletStatement, error)
func (*WalletStatement) List ¶
func (w *WalletStatement) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) ([]*WalletStatement, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.