Documentation ¶
Index ¶
- func ContainsComment(comments []Comment, targetID uint) bool
- func ContainsCookedComment(comments []CookedComment, targetID uint) bool
- type Artran
- type AuthIdentity
- type Comment
- type CookedComment
- type CookedCommentForEmail
- type CookedNotify
- type CookedPage
- type CookedSite
- type CookedUser
- type CookedUserForAdmin
- type Notify
- type Page
- type Site
- type User
- type UserEmailVerify
- type Vote
- type VoteType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsComment ¶
func ContainsCookedComment ¶
func ContainsCookedComment(comments []CookedComment, targetID uint) bool
Types ¶
type Artran ¶
type Artran struct { ID string `json:"id"` Rid string `json:"rid"` Content string `json:"content"` UA string `json:"ua"` IP string `json:"ip"` IsCollapsed string `json:"is_collapsed"` // bool => string "true" or "false" IsPending string `json:"is_pending"` // bool IsPinned string `json:"is_pinned"` // bool // vote VoteUp string `json:"vote_up"` VoteDown string `json:"vote_down"` // date CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` // user Nick string `json:"nick"` Email string `json:"email"` Link string `json:"link"` BadgeName string `json:"badge_name"` BadgeColor string `json:"badge_color"` // page PageKey string `json:"page_key"` PageTitle string `json:"page_title"` PageAdminOnly string `json:"page_admin_only"` // bool // site SiteName string `json:"site_name"` SiteURLs string `json:"site_urls"` }
数据行囊 (n 个 Artran 组成一个 Artrans) Fields All String type (FAS)
type AuthIdentity ¶
type AuthIdentity struct { gorm.Model Provider string // local, email, oauth, github RemoteUID string `gorm:"column:remote_uid;index;size:255"` UserID uint `gorm:"index"` Token string ConfirmedAt *time.Time ExpiresAt *time.Time }
func (AuthIdentity) IsEmpty ¶
func (n AuthIdentity) IsEmpty() bool
type Comment ¶
type Comment struct { gorm.Model Content string PageKey string `gorm:"index;size:255"` SiteName string `gorm:"index;size:255"` UserID uint `gorm:"index"` IsVerified bool `gorm:"default:false"` UA string IP string Rid uint `gorm:"index"` // Parent Node ID IsCollapsed bool `gorm:"default:false"` IsPending bool `gorm:"default:false"` IsPinned bool `gorm:"default:false"` VoteUp int VoteDown int RootID uint `gorm:"index"` // Root Node ID (can be derived from `Rid`) // Associated Page // // Use Composite Foreign Keys for multiple-site support. Page *Page `gorm:"foreignKey:page_key,site_name;references:key,site_name"` // Associated User User *User `gorm:"foreignKey:user_id;references:id"` }
func (Comment) IsAllowReply ¶
type CookedComment ¶
type CookedComment struct { ID uint `json:"id"` Content string `json:"content"` ContentMarked string `json:"content_marked"` UserID uint `json:"user_id"` Nick string `json:"nick"` EmailEncrypted string `json:"email_encrypted"` Link string `json:"link"` UA string `json:"ua"` Date string `json:"date"` IsCollapsed bool `json:"is_collapsed"` IsPending bool `json:"is_pending"` IsPinned bool `json:"is_pinned"` IsAllowReply bool `json:"is_allow_reply"` IsVerified bool `json:"is_verified"` Rid uint `json:"rid"` BadgeName string `json:"badge_name"` BadgeColor string `json:"badge_color"` IP string `json:"-"` IPRegion string `json:"ip_region,omitempty"` Visible bool `json:"visible"` VoteUp int `json:"vote_up"` VoteDown int `json:"vote_down"` PageKey string `json:"page_key"` PageURL string `json:"page_url"` SiteName string `json:"site_name"` }
type CookedCommentForEmail ¶
type CookedCommentForEmail struct { CookedComment Content string `json:"content"` ContentRaw string `json:"content_raw"` Nick string `json:"nick"` Email string `json:"email"` IP string `json:"ip"` Datetime string `json:"datetime"` Date string `json:"date"` Time string `json:"time"` PageKey string `json:"page_key"` PageTitle string `json:"page_title"` Page CookedPage `json:"page"` SiteName string `json:"site_name"` Site CookedSite `json:"site"` }
type CookedNotify ¶
type CookedPage ¶
type CookedSite ¶
type CookedUser ¶
type CookedUserForAdmin ¶
type CookedUserForAdmin struct { CookedUser LastIP string `json:"last_ip"` LastUA string `json:"last_ua"` IsInConf bool `json:"is_in_conf"` CommentCount int64 `json:"comment_count"` }
type Notify ¶
type Page ¶
type Page struct { gorm.Model // TODO // For historical reasons, the naming of this field does not follow best practices. // Keywords should be avoided in naming, and "key" should be changed to a different name. // // And must caution that the db query statement quoted the field name `key` with backticks. // Different db may have different rules. The pgsql is not backticks, but double quotes. // So use the pages.key (without any quotes) to instead of `key` (Mind the prefix table name). // // Consider to rename this column and make a db migration in the future. Key string `gorm:"index;size:255"` // Page key Title string AdminOnly bool SiteName string `gorm:"index;size:255"` AccessibleURL string `gorm:"-"` VoteUp int VoteDown int PV int Site *Site `gorm:"foreignKey:site_name;references:name"` }
type User ¶
type User struct { gorm.Model Name string `gorm:"index;size:255"` Email string `gorm:"index;size:255"` Link string Password string BadgeName string BadgeColor string LastIP string LastUA string IsAdmin bool ReceiveEmail bool `gorm:"default:true"` TokenValidFrom sql.NullTime // 配置文件中添加的 IsInConf bool }
func (*User) CheckPassword ¶
func (*User) SetPasswordEncrypt ¶
type UserEmailVerify ¶
Click to show internal directories.
Click to hide internal directories.