Documentation ¶
Overview ¶
Package bug contains the bug data model and low-level related functions
Index ¶
- Variables
- func ChangeLabels(b Interface, author identity.Interface, unixTime int64, add, remove []string) ([]LabelChangeResult, *LabelChangeOperation, error)
- func Create(author identity.Interface, unixTime int64, title, message string) (*Bug, *CreateOperation, error)
- func CreateWithFiles(author identity.Interface, unixTime int64, title, message string, ...) (*Bug, *CreateOperation, error)
- func Fetch(repo repository.Repo, remote string) (string, error)
- func ListLocalIds(repo repository.Repo) ([]entity.Id, error)
- func MergeAll(repo repository.ClockedRepo, remote string, mergeAuthor identity.Interface) <-chan entity.MergeResult
- func NewErrMultipleMatchBug(matching []entity.Id) *entity.ErrMultipleMatch
- func NewErrMultipleMatchOp(matching []entity.Id) *entity.ErrMultipleMatch
- func Pull(repo repository.ClockedRepo, remote string, mergeAuthor identity.Interface) error
- func Push(repo repository.Repo, remote string) (string, error)
- func ReadAll(repo repository.ClockedRepo) <-chan StreamedBug
- func ReadAllWithResolver(repo repository.ClockedRepo, identityResolver identity.Resolver) <-chan StreamedBug
- func RemoveBug(repo repository.ClockedRepo, id entity.Id) error
- type AddCommentOperation
- func AddComment(b Interface, author identity.Interface, unixTime int64, message string) (*AddCommentOperation, error)
- func AddCommentWithFiles(b Interface, author identity.Interface, unixTime int64, message string, ...) (*AddCommentOperation, error)
- func NewAddCommentOp(author identity.Interface, unixTime int64, message string, ...) *AddCommentOperation
- func (op *AddCommentOperation) Apply(snapshot *Snapshot)
- func (op *AddCommentOperation) GetFiles() []repository.Hash
- func (op *AddCommentOperation) Id() entity.Id
- func (op *AddCommentOperation) IsAuthored()
- func (op *AddCommentOperation) UnmarshalJSON(data []byte) error
- func (op *AddCommentOperation) Validate() error
- type AddCommentTimelineItem
- type Bug
- type BugsByCreationTime
- type BugsByEditTime
- type Comment
- type CommentHistoryStep
- type CommentTimelineItem
- type CreateOperation
- func (op *CreateOperation) Apply(snapshot *Snapshot)
- func (op *CreateOperation) GetFiles() []repository.Hash
- func (op *CreateOperation) Id() entity.Id
- func (op *CreateOperation) IsAuthored()
- func (op *CreateOperation) SetMetadata(key string, value string)
- func (op *CreateOperation) UnmarshalJSON(data []byte) error
- func (op *CreateOperation) Validate() error
- type CreateTimelineItem
- type EditCommentOperation
- func EditComment(b Interface, author identity.Interface, unixTime int64, target entity.Id, ...) (*EditCommentOperation, error)
- func EditCommentWithFiles(b Interface, author identity.Interface, unixTime int64, target entity.Id, ...) (*EditCommentOperation, error)
- func EditCreateComment(b Interface, author identity.Interface, unixTime int64, message string) (*EditCommentOperation, error)
- func EditCreateCommentWithFiles(b Interface, author identity.Interface, unixTime int64, message string, ...) (*EditCommentOperation, error)
- func NewEditCommentOp(author identity.Interface, unixTime int64, target entity.Id, message string, ...) *EditCommentOperation
- func (op *EditCommentOperation) Apply(snapshot *Snapshot)
- func (op *EditCommentOperation) GetFiles() []repository.Hash
- func (op *EditCommentOperation) Id() entity.Id
- func (op *EditCommentOperation) IsAuthored()
- func (op *EditCommentOperation) UnmarshalJSON(data []byte) error
- func (op *EditCommentOperation) Validate() error
- type Interface
- type Label
- type LabelChangeOperation
- type LabelChangeResult
- type LabelChangeStatus
- type LabelChangeTimelineItem
- type LabelColor
- type NoOpOperation
- type OpBase
- func (base *OpBase) AllMetadata() map[string]string
- func (base *OpBase) Author() identity.Interface
- func (base *OpBase) GetMetadata(key string) (string, bool)
- func (base *OpBase) SetMetadata(key string, value string)
- func (base *OpBase) Time() time.Time
- func (base *OpBase) Type() OperationType
- func (base *OpBase) UnmarshalJSON(data []byte) error
- func (base *OpBase) Validate(op Operation, opType OperationType) error
- type Operation
- type OperationType
- type SetMetadataOperation
- type SetStatusOperation
- type SetStatusTimelineItem
- type SetTitleOperation
- type SetTitleTimelineItem
- type Snapshot
- func (snap *Snapshot) EditTime() time.Time
- func (snap *Snapshot) GetCreateMetadata(key string) (string, bool)
- func (snap *Snapshot) HasActor(id entity.Id) bool
- func (snap *Snapshot) HasAnyActor(ids ...entity.Id) bool
- func (snap *Snapshot) HasAnyParticipant(ids ...entity.Id) bool
- func (snap *Snapshot) HasParticipant(id entity.Id) bool
- func (snap *Snapshot) Id() entity.Id
- func (snap *Snapshot) IsAuthored()
- func (snap *Snapshot) SearchComment(id entity.Id) (*Comment, error)
- func (snap *Snapshot) SearchTimelineItem(id entity.Id) (TimelineItem, error)
- type Status
- type StreamedBug
- type Term256
- type TimelineItem
- type WithSnapshot
Constants ¶
This section is empty.
Variables ¶
var ClockLoader = dag.ClockLoader(def)
var ErrBugNotExist = errors.New("bug doesn't exist")
Functions ¶
func ChangeLabels ¶
func ChangeLabels(b Interface, author identity.Interface, unixTime int64, add, remove []string) ([]LabelChangeResult, *LabelChangeOperation, error)
ChangeLabels is a convenience function to apply the operation
func Create ¶
func Create(author identity.Interface, unixTime int64, title, message string) (*Bug, *CreateOperation, error)
Convenience function to apply the operation
func CreateWithFiles ¶
func CreateWithFiles(author identity.Interface, unixTime int64, title, message string, files []repository.Hash) (*Bug, *CreateOperation, error)
func Fetch ¶
func Fetch(repo repository.Repo, remote string) (string, error)
Fetch retrieve updates from a remote This does not change the local bugs state
func ListLocalIds ¶
func ListLocalIds(repo repository.Repo) ([]entity.Id, error)
ListLocalIds list all the available local bug ids
func MergeAll ¶
func MergeAll(repo repository.ClockedRepo, remote string, mergeAuthor identity.Interface) <-chan entity.MergeResult
MergeAll will merge all the available remote bug Note: an author is necessary for the case where a merge commit is created, as this commit will have an author and may be signed if a signing key is available.
func NewErrMultipleMatchBug ¶
func NewErrMultipleMatchBug(matching []entity.Id) *entity.ErrMultipleMatch
func NewErrMultipleMatchOp ¶
func NewErrMultipleMatchOp(matching []entity.Id) *entity.ErrMultipleMatch
func Pull ¶
func Pull(repo repository.ClockedRepo, remote string, mergeAuthor identity.Interface) error
Pull will do a Fetch + MergeAll This function will return an error if a merge fail Note: an author is necessary for the case where a merge commit is created, as this commit will have an author and may be signed if a signing key is available.
func Push ¶
func Push(repo repository.Repo, remote string) (string, error)
Push update a remote with the local changes
func ReadAll ¶
func ReadAll(repo repository.ClockedRepo) <-chan StreamedBug
ReadAll read and parse all local bugs
func ReadAllWithResolver ¶
func ReadAllWithResolver(repo repository.ClockedRepo, identityResolver identity.Resolver) <-chan StreamedBug
ReadAllWithResolver read and parse all local bugs
func RemoveBug ¶
func RemoveBug(repo repository.ClockedRepo, id entity.Id) error
RemoveBug will remove a local bug from its entity.Id
Types ¶
type AddCommentOperation ¶
type AddCommentOperation struct { OpBase Message string `json:"message"` // TODO: change for a map[string]util.hash to store the filename ? Files []repository.Hash `json:"files"` }
AddCommentOperation will add a new comment in the bug
func AddComment ¶
func AddComment(b Interface, author identity.Interface, unixTime int64, message string) (*AddCommentOperation, error)
Convenience function to apply the operation
func AddCommentWithFiles ¶
func AddCommentWithFiles(b Interface, author identity.Interface, unixTime int64, message string, files []repository.Hash) (*AddCommentOperation, error)
func NewAddCommentOp ¶
func NewAddCommentOp(author identity.Interface, unixTime int64, message string, files []repository.Hash) *AddCommentOperation
func (*AddCommentOperation) Apply ¶
func (op *AddCommentOperation) Apply(snapshot *Snapshot)
func (*AddCommentOperation) GetFiles ¶
func (op *AddCommentOperation) GetFiles() []repository.Hash
func (*AddCommentOperation) Id ¶
func (op *AddCommentOperation) Id() entity.Id
func (*AddCommentOperation) IsAuthored ¶
func (op *AddCommentOperation) IsAuthored()
Sign post method for gqlgen
func (*AddCommentOperation) UnmarshalJSON ¶
func (op *AddCommentOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON is a two-steps JSON unmarshalling This workaround is necessary to avoid the inner OpBase.MarshalJSON overriding the outer op's MarshalJSON
func (*AddCommentOperation) Validate ¶
func (op *AddCommentOperation) Validate() error
type AddCommentTimelineItem ¶
type AddCommentTimelineItem struct {
CommentTimelineItem
}
CreateTimelineItem replace a AddComment operation in the Timeline and hold its edition history
func (*AddCommentTimelineItem) IsAuthored ¶
func (a *AddCommentTimelineItem) IsAuthored()
Sign post method for gqlgen
type Bug ¶
Bug holds the data of a bug thread, organized in a way close to how it will be persisted inside Git. This is the data structure used to merge two different version of the same Bug.
func Read ¶
func Read(repo repository.ClockedRepo, id entity.Id) (*Bug, error)
Read will read a bug from a repository
func ReadWithResolver ¶
func ReadWithResolver(repo repository.ClockedRepo, identityResolver identity.Resolver, id entity.Id) (*Bug, error)
ReadWithResolver will read a bug from its Id, with a custom identity.Resolver
func (*Bug) FirstOp ¶
Lookup for the very first operation of the bug. For a valid Bug, this operation should be a CreateOp
func (*Bug) LastOp ¶
Lookup for the very last operation of the bug. For a valid Bug, should never be nil
func (*Bug) Operations ¶
Operations return the ordered operations
type BugsByCreationTime ¶
type BugsByCreationTime []*Bug
func (BugsByCreationTime) Len ¶
func (b BugsByCreationTime) Len() int
func (BugsByCreationTime) Less ¶
func (b BugsByCreationTime) Less(i, j int) bool
func (BugsByCreationTime) Swap ¶
func (b BugsByCreationTime) Swap(i, j int)
type BugsByEditTime ¶
type BugsByEditTime []*Bug
func (BugsByEditTime) Len ¶
func (b BugsByEditTime) Len() int
func (BugsByEditTime) Less ¶
func (b BugsByEditTime) Less(i, j int) bool
func (BugsByEditTime) Swap ¶
func (b BugsByEditTime) Swap(i, j int)
type Comment ¶
type Comment struct { Author identity.Interface Message string Files []repository.Hash // Creation time of the comment. // Should be used only for human display, never for ordering as we can't rely on it in a distributed system. UnixTime timestamp.Timestamp // contains filtered or unexported fields }
Comment represent a comment in a Bug
func (Comment) FormatTime ¶
func (Comment) FormatTimeRel ¶
FormatTimeRel format the UnixTime of the comment for human consumption
type CommentHistoryStep ¶
type CommentHistoryStep struct { // The author of the edition, not necessarily the same as the author of the // original comment Author identity.Interface // The new message Message string UnixTime timestamp.Timestamp }
CommentHistoryStep hold one version of a message in the history
type CommentTimelineItem ¶
type CommentTimelineItem struct { Author identity.Interface Message string Files []repository.Hash CreatedAt timestamp.Timestamp LastEdit timestamp.Timestamp History []CommentHistoryStep // contains filtered or unexported fields }
CommentTimelineItem is a TimelineItem that holds a Comment and its edition history
func NewCommentTimelineItem ¶
func NewCommentTimelineItem(comment Comment) CommentTimelineItem
func (*CommentTimelineItem) Append ¶
func (c *CommentTimelineItem) Append(comment Comment)
Append will append a new comment in the history and update the other values
func (*CommentTimelineItem) Edited ¶
func (c *CommentTimelineItem) Edited() bool
Edited say if the comment was edited
func (*CommentTimelineItem) Id ¶
func (c *CommentTimelineItem) Id() entity.Id
func (*CommentTimelineItem) MessageIsEmpty ¶
func (c *CommentTimelineItem) MessageIsEmpty() bool
MessageIsEmpty return true is the message is empty or only made of spaces
type CreateOperation ¶
type CreateOperation struct { OpBase Title string `json:"title"` Message string `json:"message"` Files []repository.Hash `json:"files"` }
CreateOperation define the initial creation of a bug
func NewCreateOp ¶
func NewCreateOp(author identity.Interface, unixTime int64, title, message string, files []repository.Hash) *CreateOperation
func (*CreateOperation) Apply ¶
func (op *CreateOperation) Apply(snapshot *Snapshot)
func (*CreateOperation) GetFiles ¶
func (op *CreateOperation) GetFiles() []repository.Hash
func (*CreateOperation) Id ¶
func (op *CreateOperation) Id() entity.Id
func (*CreateOperation) IsAuthored ¶
func (op *CreateOperation) IsAuthored()
Sign post method for gqlgen
func (*CreateOperation) SetMetadata ¶
func (op *CreateOperation) SetMetadata(key string, value string)
OVERRIDE
func (*CreateOperation) UnmarshalJSON ¶
func (op *CreateOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON is a two step JSON unmarshalling This workaround is necessary to avoid the inner OpBase.MarshalJSON overriding the outer op's MarshalJSON
func (*CreateOperation) Validate ¶
func (op *CreateOperation) Validate() error
type CreateTimelineItem ¶
type CreateTimelineItem struct {
CommentTimelineItem
}
CreateTimelineItem replace a Create operation in the Timeline and hold its edition history
func (*CreateTimelineItem) IsAuthored ¶
func (c *CreateTimelineItem) IsAuthored()
Sign post method for gqlgen
type EditCommentOperation ¶
type EditCommentOperation struct { OpBase Target entity.Id `json:"target"` Message string `json:"message"` Files []repository.Hash `json:"files"` }
EditCommentOperation will change a comment in the bug
func EditComment ¶
func EditComment(b Interface, author identity.Interface, unixTime int64, target entity.Id, message string) (*EditCommentOperation, error)
EditComment is a convenience function to apply the operation
func EditCommentWithFiles ¶
func EditCreateComment ¶
func EditCreateComment(b Interface, author identity.Interface, unixTime int64, message string) (*EditCommentOperation, error)
EditCreateComment is a convenience function to edit the body of a bug (the first comment)
func EditCreateCommentWithFiles ¶
func EditCreateCommentWithFiles(b Interface, author identity.Interface, unixTime int64, message string, files []repository.Hash) (*EditCommentOperation, error)
EditCreateCommentWithFiles is a convenience function to edit the body of a bug (the first comment)
func NewEditCommentOp ¶
func NewEditCommentOp(author identity.Interface, unixTime int64, target entity.Id, message string, files []repository.Hash) *EditCommentOperation
func (*EditCommentOperation) Apply ¶
func (op *EditCommentOperation) Apply(snapshot *Snapshot)
func (*EditCommentOperation) GetFiles ¶
func (op *EditCommentOperation) GetFiles() []repository.Hash
func (*EditCommentOperation) Id ¶
func (op *EditCommentOperation) Id() entity.Id
func (*EditCommentOperation) IsAuthored ¶
func (op *EditCommentOperation) IsAuthored()
Sign post method for gqlgen
func (*EditCommentOperation) UnmarshalJSON ¶
func (op *EditCommentOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON is two steps JSON unmarshalling This workaround is necessary to avoid the inner OpBase.MarshalJSON overriding the outer op's MarshalJSON
func (*EditCommentOperation) Validate ¶
func (op *EditCommentOperation) Validate() error
type Interface ¶
type Interface interface { // Id return the Bug identifier Id() entity.Id // Validate check if the Bug data is valid Validate() error // Append an operation into the staging area, to be committed later Append(op Operation) // Operations return the ordered operations Operations() []Operation // Indicate that the in-memory state changed and need to be commit in the repository NeedCommit() bool // Commit write the staging area in Git and move the operations to the packs Commit(repo repository.ClockedRepo) error // Lookup for the very first operation of the bug. // For a valid Bug, this operation should be a CreateOp FirstOp() Operation // Lookup for the very last operation of the bug. // For a valid Bug, should never be nil LastOp() Operation // Compile a bug in a easily usable snapshot Compile() Snapshot // CreateLamportTime return the Lamport time of creation CreateLamportTime() lamport.Time // EditLamportTime return the Lamport time of the last edit EditLamportTime() lamport.Time }
type Label ¶
type Label string
func (Label) Color ¶
func (l Label) Color() LabelColor
RGBA from a Label computed in a deterministic way
type LabelChangeOperation ¶
type LabelChangeOperation struct { OpBase Added []Label `json:"added"` Removed []Label `json:"removed"` }
LabelChangeOperation define a Bug operation to add or remove labels
func ForceChangeLabels ¶
func ForceChangeLabels(b Interface, author identity.Interface, unixTime int64, add, remove []string) (*LabelChangeOperation, error)
ForceChangeLabels is a convenience function to apply the operation The difference with ChangeLabels is that no checks of deduplications are done. You are entirely responsible of what you are doing. In the general case, you want to use ChangeLabels instead. The intended use of this function is to allow importers to create legal but unexpected label changes, like removing a label with no information of when it was added before.
func NewLabelChangeOperation ¶
func NewLabelChangeOperation(author identity.Interface, unixTime int64, added, removed []Label) *LabelChangeOperation
func (*LabelChangeOperation) Apply ¶
func (op *LabelChangeOperation) Apply(snapshot *Snapshot)
Apply apply the operation
func (*LabelChangeOperation) Id ¶
func (op *LabelChangeOperation) Id() entity.Id
func (*LabelChangeOperation) IsAuthored ¶
func (op *LabelChangeOperation) IsAuthored()
Sign post method for gqlgen
func (*LabelChangeOperation) UnmarshalJSON ¶
func (op *LabelChangeOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON is a two step JSON unmarshalling This workaround is necessary to avoid the inner OpBase.MarshalJSON overriding the outer op's MarshalJSON
func (*LabelChangeOperation) Validate ¶
func (op *LabelChangeOperation) Validate() error
type LabelChangeResult ¶
type LabelChangeResult struct { Label Label Status LabelChangeStatus }
func (LabelChangeResult) String ¶
func (l LabelChangeResult) String() string
type LabelChangeStatus ¶
type LabelChangeStatus int
const ( LabelChangeAdded LabelChangeStatus LabelChangeRemoved LabelChangeDuplicateInOp LabelChangeAlreadySet LabelChangeDoesntExist )
type LabelChangeTimelineItem ¶
type LabelChangeTimelineItem struct { Author identity.Interface UnixTime timestamp.Timestamp Added []Label Removed []Label // contains filtered or unexported fields }
func (LabelChangeTimelineItem) Id ¶
func (l LabelChangeTimelineItem) Id() entity.Id
func (*LabelChangeTimelineItem) IsAuthored ¶
func (l *LabelChangeTimelineItem) IsAuthored()
Sign post method for gqlgen
type LabelColor ¶
func (LabelColor) RGBA ¶
func (lc LabelColor) RGBA() color.RGBA
func (LabelColor) Term256 ¶
func (lc LabelColor) Term256() Term256
type NoOpOperation ¶
type NoOpOperation struct {
OpBase
}
NoOpOperation is an operation that does not change the bug state. It can however be used to store arbitrary metadata in the bug history, for example to support a bridge feature.
func NoOp ¶
func NoOp(b Interface, author identity.Interface, unixTime int64, metadata map[string]string) (*NoOpOperation, error)
Convenience function to apply the operation
func (*NoOpOperation) Apply ¶
func (op *NoOpOperation) Apply(snapshot *Snapshot)
func (*NoOpOperation) Id ¶
func (op *NoOpOperation) Id() entity.Id
func (*NoOpOperation) IsAuthored ¶
func (op *NoOpOperation) IsAuthored()
Sign post method for gqlgen
func (*NoOpOperation) UnmarshalJSON ¶
func (op *NoOpOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON is a two step JSON unmarshalling This workaround is necessary to avoid the inner OpBase.MarshalJSON overriding the outer op's MarshalJSON
func (*NoOpOperation) Validate ¶
func (op *NoOpOperation) Validate() error
type OpBase ¶
type OpBase struct { OperationType OperationType `json:"type"` Author_ identity.Interface `json:"-"` // not serialized // TODO: part of the data model upgrade, this should eventually be a timestamp + lamport UnixTime int64 `json:"timestamp"` Metadata map[string]string `json:"metadata,omitempty"` // mandatory random bytes to ensure a better randomness of the data used to later generate the ID // len(Nonce) should be > 20 and < 64 bytes // It has no functional purpose and should be ignored. Nonce []byte `json:"nonce"` // contains filtered or unexported fields }
OpBase implement the common code for all operations
func (*OpBase) AllMetadata ¶
AllMetadata return all metadata for this operation
func (*OpBase) GetMetadata ¶
GetMetadata retrieve arbitrary metadata about the operation
func (*OpBase) SetMetadata ¶
SetMetadata store arbitrary metadata about the operation
func (*OpBase) Type ¶
func (base *OpBase) Type() OperationType
func (*OpBase) UnmarshalJSON ¶
type Operation ¶
type Operation interface { dag.Operation // Type return the type of the operation Type() OperationType // Time return the time when the operation was added Time() time.Time // Apply the operation to a Snapshot to create the final state Apply(snapshot *Snapshot) // SetMetadata store arbitrary metadata about the operation SetMetadata(key string, value string) // GetMetadata retrieve arbitrary metadata about the operation GetMetadata(key string) (string, bool) // AllMetadata return all metadata for this operation AllMetadata() map[string]string // contains filtered or unexported methods }
Operation define the interface to fulfill for an edit operation of a Bug
type OperationType ¶
type OperationType int
OperationType is an operation type identifier
const ( CreateOp OperationType SetTitleOp AddCommentOp SetStatusOp LabelChangeOp EditCommentOp NoOpOp SetMetadataOp )
type SetMetadataOperation ¶
type SetMetadataOperation struct { OpBase Target entity.Id `json:"target"` NewMetadata map[string]string `json:"new_metadata"` }
func NewSetMetadataOp ¶
func SetMetadata ¶
func SetMetadata(b Interface, author identity.Interface, unixTime int64, target entity.Id, newMetadata map[string]string) (*SetMetadataOperation, error)
Convenience function to apply the operation
func (*SetMetadataOperation) Apply ¶
func (op *SetMetadataOperation) Apply(snapshot *Snapshot)
func (*SetMetadataOperation) Id ¶
func (op *SetMetadataOperation) Id() entity.Id
func (*SetMetadataOperation) IsAuthored ¶
func (op *SetMetadataOperation) IsAuthored()
Sign post method for gqlgen
func (*SetMetadataOperation) UnmarshalJSON ¶
func (op *SetMetadataOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON is a two step JSON unmarshalling This workaround is necessary to avoid the inner OpBase.MarshalJSON overriding the outer op's MarshalJSON
func (*SetMetadataOperation) Validate ¶
func (op *SetMetadataOperation) Validate() error
type SetStatusOperation ¶
SetStatusOperation will change the status of a bug
func NewSetStatusOp ¶
func NewSetStatusOp(author identity.Interface, unixTime int64, status Status) *SetStatusOperation
func (*SetStatusOperation) Apply ¶
func (op *SetStatusOperation) Apply(snapshot *Snapshot)
func (*SetStatusOperation) Id ¶
func (op *SetStatusOperation) Id() entity.Id
func (*SetStatusOperation) IsAuthored ¶
func (op *SetStatusOperation) IsAuthored()
Sign post method for gqlgen
func (*SetStatusOperation) UnmarshalJSON ¶
func (op *SetStatusOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON is a two step JSON unmarshalling This workaround is necessary to avoid the inner OpBase.MarshalJSON overriding the outer op's MarshalJSON
func (*SetStatusOperation) Validate ¶
func (op *SetStatusOperation) Validate() error
type SetStatusTimelineItem ¶
type SetStatusTimelineItem struct { Author identity.Interface UnixTime timestamp.Timestamp Status Status // contains filtered or unexported fields }
func (SetStatusTimelineItem) Id ¶
func (s SetStatusTimelineItem) Id() entity.Id
func (*SetStatusTimelineItem) IsAuthored ¶
func (s *SetStatusTimelineItem) IsAuthored()
Sign post method for gqlgen
type SetTitleOperation ¶
SetTitleOperation will change the title of a bug
func NewSetTitleOp ¶
func SetTitle ¶
func SetTitle(b Interface, author identity.Interface, unixTime int64, title string) (*SetTitleOperation, error)
Convenience function to apply the operation
func (*SetTitleOperation) Apply ¶
func (op *SetTitleOperation) Apply(snapshot *Snapshot)
func (*SetTitleOperation) Id ¶
func (op *SetTitleOperation) Id() entity.Id
func (*SetTitleOperation) IsAuthored ¶
func (op *SetTitleOperation) IsAuthored()
Sign post method for gqlgen
func (*SetTitleOperation) UnmarshalJSON ¶
func (op *SetTitleOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON is a two step JSON unmarshalling This workaround is necessary to avoid the inner OpBase.MarshalJSON overriding the outer op's MarshalJSON
func (*SetTitleOperation) Validate ¶
func (op *SetTitleOperation) Validate() error
type SetTitleTimelineItem ¶
type SetTitleTimelineItem struct { Author identity.Interface UnixTime timestamp.Timestamp Title string Was string // contains filtered or unexported fields }
func (SetTitleTimelineItem) Id ¶
func (s SetTitleTimelineItem) Id() entity.Id
func (*SetTitleTimelineItem) IsAuthored ¶
func (s *SetTitleTimelineItem) IsAuthored()
Sign post method for gqlgen
type Snapshot ¶
type Snapshot struct { Status Status Title string Comments []Comment Labels []Label Author identity.Interface Actors []identity.Interface Participants []identity.Interface CreateTime time.Time Timeline []TimelineItem Operations []Operation // contains filtered or unexported fields }
Snapshot is a compiled form of the Bug data structure used for storage and merge
func (*Snapshot) GetCreateMetadata ¶
GetCreateMetadata return the creation metadata
func (*Snapshot) HasAnyActor ¶
HasAnyActor return true if one of the ids is a actor
func (*Snapshot) HasAnyParticipant ¶
HasAnyParticipant return true if one of the ids is a participant
func (*Snapshot) HasParticipant ¶
HasParticipant return true if the id is a participant
func (*Snapshot) SearchComment ¶
SearchComment will search for a comment matching the given hash
func (*Snapshot) SearchTimelineItem ¶
func (snap *Snapshot) SearchTimelineItem(id entity.Id) (TimelineItem, error)
SearchTimelineItem will search in the timeline for an item matching the given hash
type StreamedBug ¶
type TimelineItem ¶
type WithSnapshot ¶
type WithSnapshot struct { *Bug // contains filtered or unexported fields }
WithSnapshot encapsulate a Bug and maintain the corresponding Snapshot efficiently
func (*WithSnapshot) Append ¶
func (b *WithSnapshot) Append(op Operation)
Append intercept Bug.Append() to update the snapshot efficiently
func (*WithSnapshot) Commit ¶
func (b *WithSnapshot) Commit(repo repository.ClockedRepo) error
Commit intercept Bug.Commit() to update the snapshot efficiently
func (*WithSnapshot) Snapshot ¶
func (b *WithSnapshot) Snapshot() *Snapshot
Snapshot return the current snapshot