Documentation ¶
Overview ¶
Package comments represents the comment resource
Index ¶
Constants ¶
const ( // TableName is the database table for this resource TableName = "comments" // KeyName is the primary key value for this resource KeyName = "id" // Order defines the default sort order in sql for this resource Order = "rank desc, points desc, id desc" )
Variables ¶
This section is empty.
Functions ¶
func AllowedParams ¶
func AllowedParams() []string
AllowedParams returns an array of allowed param keys for Update and Create.
func AllowedParamsAdmin ¶
func AllowedParamsAdmin() []string
AllowedParamsAdmin returns an array of allowed param keys for Update and Create.
Types ¶
type Comment ¶
type Comment struct { // resource.Base defines behaviour and fields shared between all resources resource.Base // status.ResourceStatus defines a status field and associated behaviour status.ResourceStatus DottedIDs string ParentID int64 Children []*Comment Points int64 Rank int64 StoryID int64 StoryName string Text string UserID int64 UserName string }
Comment handles saving and retreiving comments from the database
func FindFirst ¶ added in v1.0.1
FindFirst fetches a single comment record from the database using a where query with the format and args provided.
func NewWithColumns ¶
NewWithColumns creates a new comment instance and fills it with data from the database cols provided.
func (*Comment) Editable ¶
Editable returns true if this comment is editable. Comments are editable if less than 3 hours old.
func (*Comment) NegativePoints ¶
NegativePoints returns a negative point score between 0 and 5 (positive points return 0, below -6 returns 6)