Documentation ¶
Index ¶
- Constants
- func NewDBEngine(databaseSetting *setting.DatabaseSettingS) (*gorm.DB, error)
- type Attachment
- type AttachmentType
- type Captcha
- type Comment
- 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) 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
- type CommentFormated
- type CommentReply
- func (c *CommentReply) Create(db *gorm.DB) (*CommentReply, error)
- func (c *CommentReply) Delete(db *gorm.DB) 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 Message
- func (m *Message) Count(db *gorm.DB, conditions *ConditionsT) (int64, error)
- func (m *Message) Create(db *gorm.DB) (*Message, error)
- func (m *Message) Format() *MessageFormated
- func (m *Message) Get(db *gorm.DB) (*Message, error)
- func (c *Message) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) ([]*Message, 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) Create(db *gorm.DB) (*Post, error)
- func (s *Post) Delete(db *gorm.DB) 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 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
- type PostContentFormated
- type PostContentT
- type PostFormated
- type PostStar
- func (p *PostStar) Count(db *gorm.DB, conditions *ConditionsT) (int64, 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, offset, limit int) ([]*PostStar, error)
- type Tag
- type TagFormated
- type User
- type UserFormated
- 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 ( UserStatusNormal int = iota + 1 UserStatusClosed )
View Source
const MSG_READED = 1
View Source
const MSG_UNREAD = 0
Variables ¶
This section is empty.
Functions ¶
func NewDBEngine ¶
func NewDBEngine(databaseSetting *setting.DatabaseSettingS) (*gorm.DB, error)
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 ( ATTACHMENT_TYPE_IMAGE AttachmentType = iota + 1 ATTACHMENT_TYPE_VIDEO ATTACHMENT_TYPE_OTHER )
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"` }
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) List ¶
func (c *CommentContent) List(db *gorm.DB, conditions *ConditionsT, offset, limit int) ([]*CommentContent, error)
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"` CreatedOn int64 `json:"created_on"` ModifiedOn int64 `json:"modified_on"` }
type CommentReply ¶
type CommentReply struct { *Model CommentID int64 `json:"comment_id"` UserID int64 `json:"user_id"` AtUserID int64 `json:"at_user_id"` Content string `json:"content"` IP string `json:"ip"` IPLoc string `json:"ip_loc"` }
func (*CommentReply) Create ¶
func (c *CommentReply) Create(db *gorm.DB) (*CommentReply, 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 `json:"comment_id"` UserID int64 `json:"user_id"` User *UserFormated `json:"user"` AtUserID int64 `json:"at_user_id"` AtUser *UserFormated `json:"at_user"` Content string `json:"content"` IPLoc string `json:"ip_loc"` CreatedOn int64 `json:"created_on"` ModifiedOn int64 `json:"modified_on"` }
type ConditionsT ¶
type ConditionsT map[string]interface{}
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) 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"` 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
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"` 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 PostCollection ¶
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) 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)
type PostContentFormated ¶
type PostContentFormated struct { ID int64 `json:"id"` PostID int64 `json:"post_id"` Content string `json:"content"` Type PostContentT `json:"type"` Sort int64 `json:"sort"` }
type PostContentT ¶
type PostContentT int
const ( CONTENT_TYPE_TITLE PostContentT = iota + 1 CONTENT_TYPE_TEXT CONTENT_TYPE_IMAGE CONTENT_TYPE_VIDEO CONTENT_TYPE_AUDIO CONTENT_TYPE_LINK CONTENT_TYPE_ATTACHMENT CONTENT_TYPE_CHARGE_ATTACHMENT )
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"` 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 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 TagFormated struct { ID int64 `json:"id"` UserID int64 `json:"user_id"` User *UserFormated `json:"user"` Tag string `json:"tag"` QuoteNum int64 `json:"quote_num"` }
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
type UserFormated ¶
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)
Click to show internal directories.
Click to hide internal directories.