Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrOverQuota = errors.New("quota exceeded")
Functions ¶
Types ¶
type Conf ¶
type Conf struct { Title string AnalyticsID string Description string Keywords string WriteMsg string Version string }
Conf holds configuration values that the program needs.
type Suggestion ¶
Suggestion represents a suggestion that a user can create.
func FilterByText ¶
func FilterByText(suggs []Suggestion, text string) []Suggestion
FilterByText returns suggestions whose Text contains the provided text. It is used to search a slice of suggestions and return only those containing the given text.
func FilterByUser ¶
func FilterByUser(suggs []Suggestion, username string) []Suggestion
FilterByUser returns suggestions whose Username contains the provided username. It is used to filter a slice of suggestions by username.
func FindByID ¶
func FindByID(suggs []Suggestion, id uint64) (int, *Suggestion)
FindByID first sorts the slice of suggestions by ID and then searches for the given id. If the id is found in the slice then it returns the index and the suggestion. If the id is not found then it returns index -1 and nil.
func (*Suggestion) FmtCreated ¶
func (s *Suggestion) FmtCreated() string
FmtCreated returns the creation time of the suggestion formatted as:
Mon 02 Jan 2006 15:04:05 MST
type SuggestionStore ¶
type SuggestionStore interface { // Create creates a new suggestion for a user. Create(username string, sugg *Suggestion) error // OfUser gets all the suggestions created by a user. OfUser(username string) ([]Suggestion, error) // All returns all the suggestions. All() ([]Suggestion, error) // Delete deletes a user's suggestion. Delete(username string, id uint64) error CheckQuota(username string, n Quota) (Quota, error) }
SuggestionStore describes all the operations that need to access a storage for the suggestions.