Documentation ¶
Index ¶
- func UnapprovedCommentsCount(db *sql.DB) (int, error)
- func UserCount(db *sql.DB) int
- type Comment
- func AllComments(db *sql.DB, url string) []Comment
- func AllCommentsPaginated(db *sql.DB, page int) ([]Comment, int)
- func ApprovedComments(db *sql.DB, url string, email string) []Comment
- func GetComment(db *sql.DB, id int) *Comment
- func NewComment(email, name, title, body, url, ip string) Comment
- func UnapprovedComments(db *sql.DB) []Comment
- type Config
- type PaginatedComments
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Comment ¶
type Comment struct { Id int64 `form:"-"` Created int64 `form:"-"` Email string `binding:"required" form:"email"` Name string `binding:"required" form:"name"` Body string `binding:"required" form:"body"` Url string `binding:"required" form:"url"` ClientIp string `form:"-"` Approved bool `form:"-"` }
Comment represents a single comment with all its associated data.
func NewComment ¶
NewComment creates a comment and sets the current time as its Created date.
func UnapprovedComments ¶
func (*Comment) MarshalJSON ¶
MarshalJSON implements the Marshal interface to serialize the comment.
type Config ¶
type Config struct { General struct { Approval bool Origin []string Markdown bool Secret string Templates string Prefix string } Database struct { Driver string Access string } Rate_Limit struct { Enable bool Max_Comments int64 Seconds int64 } Email struct { Notify bool From string To []string Username string Password string Host string Port int } }
Config represents the user's config that's read from a gcfg file.
func LoadConfig ¶
LoadConfig loads the config from disc and outputs an error if the file could no be read.
type PaginatedComments ¶
PaginatedComments helps to easily divide a set of Comments into TotalPages/PerPage slices.
Click to show internal directories.
Click to hide internal directories.