Documentation
¶
Overview ¶
Package feedback stores user votes on answers so confirmed answers rise and corrected ones sink in future rankings. Votes live in their own file, apart from the index, so they survive re-indexing.
Index ¶
Constants ¶
View Source
const ( // Helpful marks a result the user confirmed. Helpful = 1 // NotHelpful marks a result the user corrected. NotHelpful = -1 )
Votes a user can cast on one result.
Variables ¶
View Source
var ErrBadEntry = errors.New("entry needs a query, one target, and a helpful or not-helpful vote")
ErrBadEntry reports a vote missing its query, target, or a known vote value.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
// Query is the question as asked.
Query string `json:"query"`
// Person is the voted person's identifier, when the vote is on a person.
Person string `json:"person,omitempty"`
// Channel is the voted channel's identifier, when the vote is on a channel.
Channel string `json:"channel,omitempty"`
// Vote is Helpful or NotHelpful.
Vote int `json:"vote"`
// Comment is an optional note explaining the vote.
Comment string `json:"comment,omitempty"`
// Time is when the vote was cast.
Time time.Time `json:"time"`
}
Entry is one vote on one result for one question.
type Filter ¶ added in v0.1.18
type Filter struct {
// Query matches entries for this exact question, case-insensitively.
Query string
// Person matches votes on this person identifier.
Person string
// Channel matches votes on this channel name.
Channel string
}
Filter selects the votes to list or clear. Zero fields match everything; set fields must all match.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds votes and persists them as JSON. It is safe for concurrent use.
Click to show internal directories.
Click to hide internal directories.