Documentation ¶
Index ¶
Constants ¶
const ( Open = "Open" Submitted = "Submitted" Discarded = "Discarded" )
Variables ¶
var (
ErrNotFound = errors.New("review does not exist")
)
Functions ¶
This section is empty.
Types ¶
type Annotation ¶
type Annotation struct { File int `json:"file"` Hunk int `json:"hunk"` Line int `json:"line"` Comment string `json:"comment"` User string `json:"user"` Published bool `json:"published"` }
Annotation is a message about a particular line in a hunk. It is made by particular user who may or may not have published it. If an annotation is published, other reviewers will be able to view it.
type Revision ¶
type Revision struct { Files []diff.File `json:"files"` Annotations []Annotation `json:"annotations"` }
A revision is a set of diff.Files with corresponding annotations. Annotations are a list of comments on a given line of the diff, identified by file, hunk and line-number indices.
func (*Revision) Annotate ¶
func (r *Revision) Annotate(a Annotation)
Annotate annotates a file at a particular hunk and line number.
func (Revision) GetAnnotations ¶
func (r Revision) GetAnnotations(file, hunk, line int, currentUser string) []Annotation
GetAnnotations gets the published annotations at the index provided. If none exists, it returns a nil slice.
func (Revision) UnpublishedAnnotationsFor ¶
UnpublishedAnnotationsFor counts the number of un-published annotations made by user.
type Summary ¶
type Summary struct { ID int `json:"id"` CommitMsg string `json:"commitMsg"` Submitter string `json:"submitter"` SubmittedAt time.Time `json:"submittedAt"` UpdatedAt time.Time `json:"updatedAt"` Repository string `json:"repository"` Status string `json:"status"` }
A Summary contains cursory facts about a Review.