fabric8-wit: github.com/fabric8-services/fabric8-wit/comment Index | Files

package comment

import "github.com/fabric8-services/fabric8-wit/comment"

Package comment contains all the required operations to manage comments done in the work items.

Index

Package Files

comment.go comment_repository.go comment_revision.go comment_revision_repository.go doc.go

type Comment Uses

type Comment struct {
    gormsupport.Lifecycle
    ID       uuid.UUID `sql:"type:uuid default uuid_generate_v4()" gorm:"primary_key"` // This is the ID PK field
    ParentID uuid.UUID `sql:"type:uuid"`
    Creator  uuid.UUID `sql:"type:uuid"` // Belongs To Identity
    Body     string
    Markup   string
}

Comment describes a single comment

func (Comment) GetETagData Uses

func (m Comment) GetETagData() []interface{}

GetETagData returns the field values to use to generate the ETag

func (Comment) GetLastModified Uses

func (m Comment) GetLastModified() time.Time

GetLastModified returns the last modification time

func (Comment) TableName Uses

func (m Comment) TableName() string

TableName overrides the table name settings in Gorm to force a specific table name in the database.

type GormCommentRepository Uses

type GormCommentRepository struct {
    // contains filtered or unexported fields
}

GormCommentRepository is the implementation of the storage interface for Comments.

func (*GormCommentRepository) CheckExists Uses

func (m *GormCommentRepository) CheckExists(ctx context.Context, id string) error

CheckExists returns nil if the given ID exists otherwise returns an error

func (*GormCommentRepository) Count Uses

func (m *GormCommentRepository) Count(ctx context.Context, parentID uuid.UUID) (int, error)

Count all comments related to a single item

func (*GormCommentRepository) Create Uses

func (m *GormCommentRepository) Create(ctx context.Context, comment *Comment, creatorID uuid.UUID) error

Create creates a new record.

func (*GormCommentRepository) Delete Uses

func (m *GormCommentRepository) Delete(ctx context.Context, commentID uuid.UUID, suppressorID uuid.UUID) error

Delete a single comment

func (*GormCommentRepository) List Uses

func (m *GormCommentRepository) List(ctx context.Context, parentID uuid.UUID, start *int, limit *int) ([]Comment, uint64, error)

List all comments related to a single item

func (*GormCommentRepository) Load Uses

func (m *GormCommentRepository) Load(ctx context.Context, id uuid.UUID) (*Comment, error)

Load a single comment regardless of parent

func (*GormCommentRepository) Save Uses

func (m *GormCommentRepository) Save(ctx context.Context, comment *Comment, modifierID uuid.UUID) error

Save a single comment

type GormCommentRevisionRepository Uses

type GormCommentRevisionRepository struct {
    // contains filtered or unexported fields
}

GormCommentRevisionRepository implements CommentRevisionRepository using gorm

func NewRevisionRepository Uses

func NewRevisionRepository(db *gorm.DB) *GormCommentRevisionRepository

NewRevisionRepository creates a GormCommentRevisionRepository

func (*GormCommentRevisionRepository) Create Uses

func (r *GormCommentRevisionRepository) Create(ctx context.Context, modifierID uuid.UUID, revisionType RevisionType, c Comment) error

Create stores a new revision for the given comment.

func (*GormCommentRevisionRepository) List Uses

func (r *GormCommentRevisionRepository) List(ctx context.Context, commentID uuid.UUID) ([]Revision, error)

List retrieves all revisions for a given comment

type Repository Uses

type Repository interface {
    repository.Exister
    Create(ctx context.Context, comment *Comment, creator uuid.UUID) error
    Save(ctx context.Context, comment *Comment, modifier uuid.UUID) error
    Delete(ctx context.Context, commentID uuid.UUID, suppressor uuid.UUID) error
    List(ctx context.Context, parent uuid.UUID, start *int, limit *int) ([]Comment, uint64, error)
    Load(ctx context.Context, id uuid.UUID) (*Comment, error)
    Count(ctx context.Context, parentID uuid.UUID) (int, error)
}

Repository describes interactions with comments

func NewRepository Uses

func NewRepository(db *gorm.DB) Repository

NewRepository creates a new storage type.

type Revision Uses

type Revision struct {
    ID  uuid.UUID `gorm:"primary_key"`
    // the timestamp of the modification
    Time time.Time `gorm:"column:revision_time"`
    // the type of modification
    Type RevisionType `gorm:"column:revision_type"`
    // the identity of author of the comment modification
    ModifierIdentity uuid.UUID `sql:"type:uuid" gorm:"column:modifier_id"`
    // the id of the comment that changed
    CommentID uuid.UUID `gorm:"column:comment_id"`
    // the id of the parent of the comment that changed
    CommentParentID uuid.UUID `gorm:"column:comment_parent_id"`
    // the body of the comment (nil when comment was deleted)
    CommentBody *string `gorm:"column:comment_body"`
    // the markup used to input the comment body (nil when comment was deleted)
    CommentMarkup *string `gorm:"column:comment_markup"`
}

Revision represents a version of a comment

func (Revision) TableName Uses

func (w Revision) TableName() string

TableName implements gorm.tabler

type RevisionRepository Uses

type RevisionRepository interface {
    // Create stores a new revision for the given comment.
    Create(ctx context.Context, modifierID uuid.UUID, revisionType RevisionType, comment Comment) error
    // List retrieves all revisions for a given comment
    List(ctx context.Context, workitemID uuid.UUID) ([]Revision, error)
}

RevisionRepository encapsulates storage & retrieval of historical versions of comments

type RevisionType Uses

type RevisionType int

RevisionType defines the type of revision for a comment

const (

    // RevisionTypeCreate a comment creation
    RevisionTypeCreate RevisionType // 1
    // RevisionTypeDelete a comment deletion
    RevisionTypeDelete // 2

    // RevisionTypeUpdate a comment update
    RevisionTypeUpdate // 4
)

Package comment imports 12 packages (graph) and is imported by 8 packages. Updated 2017-10-23. Refresh now. Tools for package owners.