Documentation
¶
Overview ¶
Package stories represents the story resource
Index ¶
- func AllowedParams() []string
- func AllowedParamsAdmin() []string
- func Create(params map[string]string) (int64, error)
- func Popular() *query.Query
- func Published() *query.Query
- func Query() *query.Query
- func Where(format string, args ...interface{}) *query.Query
- type Story
- func (m *Story) CanonicalURL() string
- func (m *Story) Code() bool
- func (m *Story) CommentCountDisplay() string
- func (m *Story) DestinationURL() string
- func (m *Story) Destroy() error
- func (m *Story) Domain() string
- func (m *Story) Editable() bool
- func (m *Story) GodocURL() string
- func (m *Story) NameDisplay() string
- func (m *Story) NegativePoints() int64
- func (m *Story) OwnedBy(uid int64) bool
- func (m *Story) PrimaryURL() string
- func (m *Story) ShowAsk() bool
- func (m *Story) Tags() []string
- func (m *Story) Update(params map[string]string) error
- func (m *Story) VetURL() string
- func (m *Story) YouTube() bool
- func (m *Story) YouTubeURL() string
Constants ¶
This section is empty.
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 Story ¶
type Story struct { model.Model status.ModelStatus Name string Summary string Url string Rank int64 Points int64 UserId int64 UserName string CommentCount int64 }
Story handles saving and retreiving stories from the database
func NewWithColumns ¶
NewWithColumns creates a new story instance and fills it with data from the database cols provided
func (*Story) CanonicalURL ¶
CanonicalURL is the canonical URL of the story on this site including a slug for seo
func (*Story) Code ¶
Code returns true if this is a link to a git repository At present we only check for github urls, we should at least check for bitbucket
func (*Story) CommentCountDisplay ¶
CommentCountDisplay returns the comment count or ellipsis if count is 0
func (*Story) DestinationURL ¶
DestinationURL returns the URL of the story if no url is set, it uses the CanonicalURL
func (*Story) Editable ¶
Editable returns true if this story is editable. Stories are editable if less than 1 hours old
func (*Story) NameDisplay ¶
NameDisplay returns a title string without hashtags (assumed to be at the end), by truncating the title at the first #
func (*Story) NegativePoints ¶
NegativePoints returns a negative point score or 0 if points is above 0
func (*Story) PrimaryURL ¶
PrimaryURL returns the URL to use for this story in lists Videos and Show Ask stories link to the story, for other links for now it is the destination
func (*Story) Tags ¶
Tags are defined as words beginning with # in the title TODO: for speed and clarity we could extract at submit time instead and store in db