Documentation ¶
Overview ¶
Package comments represents the comment resource
Index ¶
- Constants
- func AllowedParams() []string
- func AllowedParamsAdmin() []string
- func Create(params map[string]string) (int64, error)
- func Published() *query.Query
- func Query() *query.Query
- func Where(format string, args ...interface{}) *query.Query
- type Comment
- func (m *Comment) Destroy() error
- func (m *Comment) Editable() bool
- func (m *Comment) Level() int64
- func (m *Comment) NegativePoints() int64
- func (m *Comment) OwnedBy(uid int64) bool
- func (m *Comment) Root() bool
- func (m *Comment) URLStory() string
- func (m *Comment) Update(params map[string]string) error
Constants ¶
const RankOrder = "points desc, id desc"
RankOrder orders comments by points then created at
Variables ¶
This section is empty.
Functions ¶
func AllowedParams ¶
func AllowedParams() []string
AllowedParams returns an array of allowed param keys
func AllowedParamsAdmin ¶
func AllowedParamsAdmin() []string
AllowedParamsAdmin returns an array of allowed param keys
func Create ¶
Create inserts a new record in the database using params, and returns the newly created id
Types ¶
type Comment ¶
type Comment struct { model.Model status.ModelStatus Text string Points int64 Rank int64 // Comment tree ParentId int64 DottedIds string Children []*Comment //Join ids UserId int64 StoryId int64 // Denormalised join details, for quick display, alternatively could use joins UserName string StoryName string }
Comment handles saving and retreiving comments from the database
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)