Documentation
¶
Index ¶
- Constants
- func CleanDomain(domain string) string
- func CleanURL(url string) string
- func ExtractDomainFromURL(urlStr string) (error, string)
- func GetDomainHashKey(domain string) string
- func GetURLContentCount(dbi *gorm.DB) (uint, error)
- func GetURLHashKey(url string) string
- type Article
- type BaseModel
- type Domain
- type DomainVote
- type IntegrationHistory
- type RegisterIntegrationWorkerInfo
- type URLContent
- type URLContentComment
- type URLContentCommentVote
- type User
- func (user *User) BeforeCreate() error
- func (user *User) CancelCommentVote(like bool)
- func (user *User) GetBalance() *big.Int
- func (user *User) IncrementCommentVote(like bool)
- func (user *User) IncrementIntegration(score int64)
- func (user *User) SetBalance(num *big.Int)
- func (user *User) SetUniqueID(db *gorm.DB) error
- func (user *User) SwitchCommentVote(like bool)
- func (user *User) VerifyPassword(password string) bool
- type UserOAuth
Constants ¶
View Source
const OAuthGoogle = 1
Variables ¶
This section is empty.
Functions ¶
func CleanDomain ¶
func ExtractDomainFromURL ¶
func GetDomainHashKey ¶
func GetURLHashKey ¶
Types ¶
type Article ¶
type Article struct {
BaseModel
UserID uint `gorm:"index" json:"-"`
Title string `gorm:"type:text" form:"title" json:"title" binding:"required"`
Abstract string `gorm:"type:text" json:"abstract"`
Content string `gorm:"type:longtext" form:"content" json:"content" binding:"required"`
Language string `gorm:"column:lang;size:64" json:"language"`
ContentId string `gorm:"type:varchar(128);unique_index" json:"content_id"`
ContentDNA string `gorm:"type:varchar(128);unique_index" json:"content_dna"`
}
func (*Article) DetectLanguage ¶
type BaseModel ¶
type BaseModel struct {
ID uint `gorm:"primary_key" json:"-"`
CreatedAt uint `json:"created_at"`
UpdatedAt uint `json:"updated_at"`
}
func (*BaseModel) BeforeCreate ¶
func (*BaseModel) BeforeUpdate ¶
type Domain ¶
type Domain struct {
BaseModel
UserID uint `json:"-"`
Domain string `gorm:"type:text" json:"domain"`
Title string `gorm:"type:text" json:"title"`
HashKey string `gorm:"type:varchar(128);unique_index" json:"-"`
IsActive bool `gorm:"default:false" json:"is_active"`
Votes uint `gorm:"default:1" json:"votes"`
}
type DomainVote ¶
type IntegrationHistory ¶
type IntegrationHistory struct {
BaseModel
UserID uint `json:"-"`
UniqueID string `json:"id" gorm:"type:varchar(128);unique_index"`
Integration int64 `json:"integration"`
Description string `json:"description"`
Data string `json:"-"`
User User `gorm:"save_associations:false" json:"user"`
}
func (*IntegrationHistory) SetUniqueID ¶
func (m *IntegrationHistory) SetUniqueID() error
type URLContent ¶
type URLContent struct {
BaseModel
UserID uint `json:"-"`
URL string `gorm:"type:text" json:"url"`
HashKey string `gorm:"type:varchar(128);unique_index" json:"-"`
TotalComment uint `gorm:"default:1" json:"total_comment"`
}
func GetURLContentByURL ¶
type URLContentComment ¶
type URLContentComment struct {
BaseModel
UniqueID string `gorm:"type:varchar(128);unique_index" json:"id"`
UserID uint `json:"-"`
URLContentId uint `json:"-"`
Content string `gorm:"type:longtext" json:"content"`
CommentUpVotes uint `json:"comment_up_votes" gorm:"type:INT(11);default:0"`
CommentDownVotes uint `json:"comment_down_votes" gorm:"type:INT(11);default:0"`
User User `gorm:"save_associations:false" json:"user"`
IsDeleted bool `gorm:"default:false" json:"is_deleted"`
}
func (*URLContentComment) CancelVote ¶
func (comment *URLContentComment) CancelVote(like bool)
func (*URLContentComment) IncrementVote ¶
func (comment *URLContentComment) IncrementVote(like bool)
func (*URLContentComment) SetUniqueID ¶
func (comment *URLContentComment) SetUniqueID(db *gorm.DB) error
func (*URLContentComment) SwitchVote ¶
func (comment *URLContentComment) SwitchVote(like bool)
type URLContentCommentVote ¶
type URLContentCommentVote struct {
BaseModel
UniqueID string `json:"id" gorm:"type:varchar(128);unique_index"`
UserID uint `json:"-"`
URLContentCommentID uint `json:"-"`
Like bool `json:"like"`
User User `gorm:"save_associations:false" json:"user"`
}
func (*URLContentCommentVote) CheckVoteExists ¶
func (*URLContentCommentVote) SetUniqueID ¶
func (comment *URLContentCommentVote) SetUniqueID() error
type User ¶
type User struct {
BaseModel
UniqueID string `json:"id" gorm:"type:varchar(128);unique_index"`
Username string `json:"-" gorm:"type:varchar(128);index"`
Password string `json:"-"`
Salt string `json:"-"`
Nickname string `json:"nickname"`
AvatarURL string `json:"avatar_url"`
Integration int64 `json:"integration" gorm:"type:INT(18);default:0"`
CommentUpVotes uint `json:"comment_up_votes" gorm:"type:INT(11);default:0"`
CommentDownVotes uint `json:"comment_down_votes" gorm:"type:INT(11);default:0"`
Balance string `json:"balance"`
}
func (*User) BeforeCreate ¶
func (*User) CancelCommentVote ¶
func (*User) GetBalance ¶
func (*User) IncrementCommentVote ¶
func (*User) IncrementIntegration ¶
func (*User) SetBalance ¶
func (*User) SwitchCommentVote ¶
func (*User) VerifyPassword ¶
Click to show internal directories.
Click to hide internal directories.