models

package
v0.0.0-...-c9c49cf Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const OAuthGoogle = 1

Variables

This section is empty.

Functions

func CleanDomain

func CleanDomain(domain string) string

func CleanURL

func CleanURL(url string) string

func ExtractDomainFromURL

func ExtractDomainFromURL(urlStr string) (error, string)

func GetDomainHashKey

func GetDomainHashKey(domain string) string

func GetURLContentCount

func GetURLContentCount(dbi *gorm.DB) (uint, error)

func GetURLHashKey

func GetURLHashKey(url string) string

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

func (article *Article) DetectLanguage() string

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 (model *BaseModel) BeforeCreate() error

func (*BaseModel) BeforeUpdate

func (model *BaseModel) BeforeUpdate() error

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

func GetDomainByDomainName

func GetDomainByDomainName(domain string, dbi *gorm.DB, forUpdate bool) (error, *Domain)

type DomainVote

type DomainVote struct {
	BaseModel
	UserID   uint
	DomainID uint
}

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 RegisterIntegrationWorkerInfo

type RegisterIntegrationWorkerInfo struct {
	BaseModel
	LastDoneUserID uint `json:"-"`
}

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

func GetURLContentByURL(url string, dbi *gorm.DB, forUpdate bool) (error, *URLContent)

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 (common *URLContentCommentVote) CheckVoteExists(dbi *gorm.DB, uniqueID string) (bool, error)

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 *User) BeforeCreate() error

func (*User) CancelCommentVote

func (user *User) CancelCommentVote(like bool)

func (*User) GetBalance

func (user *User) GetBalance() *big.Int

func (*User) IncrementCommentVote

func (user *User) IncrementCommentVote(like bool)

func (*User) IncrementIntegration

func (user *User) IncrementIntegration(score int64)

func (*User) SetBalance

func (user *User) SetBalance(num *big.Int)

func (*User) SetUniqueID

func (user *User) SetUniqueID(db *gorm.DB) error

func (*User) SwitchCommentVote

func (user *User) SwitchCommentVote(like bool)

func (*User) VerifyPassword

func (user *User) VerifyPassword(password string) bool

type UserOAuth

type UserOAuth struct {
	BaseModel
	UserID     uint
	VendorType uint
	VendorID   string
}

Jump to

Keyboard shortcuts

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