workitem

package
v42.0.0-...-56f38d9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2017 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package workitem contains the code that allows to manage work items, work item types.

Index

Constants

View Source
const (
	SystemVersion = "version"

	SystemRemoteItemID        = "system.remote_item_id"
	SystemNumber              = "system.number"
	SystemTitle               = "system.title"
	SystemDescription         = "system.description"
	SystemDescriptionMarkup   = "system.description.markup"
	SystemDescriptionRendered = "system.description.rendered"
	SystemState               = "system.state"
	SystemAssignees           = "system.assignees"
	SystemCreator             = "system.creator"
	SystemCreatedAt           = "system.created_at"
	SystemUpdatedAt           = "system.updated_at"
	SystemOrder               = "system.order"
	SystemIteration           = "system.iteration"
	SystemArea                = "system.area"
	SystemCodebase            = "system.codebase"

	SystemStateOpen       = "open"
	SystemStateNew        = "new"
	SystemStateInProgress = "in progress"
	SystemStateResolved   = "resolved"
	SystemStateClosed     = "closed"
)

String constants for the local work item types.

Variables

View Source
var (
	// base item type with common fields for planner item types like userstory, experience, bug, feature, etc.
	SystemPlannerItem      = uuid.FromStringOrNil("86af5178-9b41-469b-9096-57e5155c3f31") // "planneritem"
	SystemTask             = uuid.FromStringOrNil("bbf35418-04b6-426c-a60b-7f80beb0b624") // "task"
	SystemValueProposition = uuid.FromStringOrNil("3194ab60-855b-4155-9005-9dce4a05f1eb") // "valueproposition"
	SystemFundamental      = uuid.FromStringOrNil("ee7ca005-f81d-4eea-9b9b-1965df0988d0") // "fundamental"
	SystemExperience       = uuid.FromStringOrNil("b9a71831-c803-4f66-8774-4193fffd1311") // "experience"
	SystemFeature          = uuid.FromStringOrNil("0a24d3c2-e0a6-4686-8051-ec0ea1915a28") // "feature"
	SystemScenario         = uuid.FromStringOrNil("71171e90-6d35-498f-a6a7-2083b5267c18") // "scenario"
	SystemBug              = uuid.FromStringOrNil("26787039-b68f-4e28-8814-c2f93be1ef4e") // "bug"
	SystemPapercuts        = uuid.FromStringOrNil("6d603ab4-7c5e-4c5f-bba8-a3ba9d370985") // "papercuts"
)

Never ever change these UUIDs!!!

Functions

func ClearGlobalWorkItemTypeCache

func ClearGlobalWorkItemTypeCache()

ClearGlobalWorkItemTypeCache removes all work items from the global cache

func Compile

func Compile(where criteria.Expression) (whereClause string, parameters []interface{}, err []error)

Compile takes an expression and compiles it to a where clause for use with gorm.DB.Where() Returns the number of expected parameters for the query and a slice of errors if something goes wrong

func ConvertList

func ConvertList(converter Converter, componentType SimpleType, value interface{}) ([]interface{}, error)

func GetTypePathSeparator

func GetTypePathSeparator() string

GetTypePathSeparator returns the work item type's path separator "."

func LtreeSafeID

func LtreeSafeID(witID uuid.UUID) string

LtreeSafeID returns the ID of the work item type in an postgres ltree safe manner The returned string can be used as an ltree node.

func ParseWorkItemIDToUint64

func ParseWorkItemIDToUint64(wiIDStr string) (uint64, error)

ParseWorkItemIDToUint64 does what it says

Types

type Converter

type Converter func(FieldType, interface{}) (interface{}, error)

type DirectionType

type DirectionType string
const (
	DirectionAbove  DirectionType = "above"
	DirectionBelow  DirectionType = "below"
	DirectionTop    DirectionType = "top"
	DirectionBottom DirectionType = "bottom"
)

type EnumType

type EnumType struct {
	SimpleType
	BaseType SimpleType
	Values   []interface{}
}

func (EnumType) ConvertFromModel

func (t EnumType) ConvertFromModel(value interface{}) (interface{}, error)

func (EnumType) ConvertToModel

func (t EnumType) ConvertToModel(value interface{}) (interface{}, error)

func (EnumType) Equal

func (t EnumType) Equal(u convert.Equaler) bool

Equal returns true if two EnumType objects are equal; otherwise false is returned.

type FieldDefinition

type FieldDefinition struct {
	Required    bool
	Label       string
	Description string
	Type        FieldType
}

FieldDefinition describes type & other restrictions of a field

func (FieldDefinition) ConvertFromModel

func (f FieldDefinition) ConvertFromModel(name string, value interface{}) (interface{}, error)

ConvertFromModel converts a field value for use in the REST API layer

func (FieldDefinition) ConvertToModel

func (f FieldDefinition) ConvertToModel(name string, value interface{}) (interface{}, error)

ConvertToModel converts a field value for use in the persistence layer

func (FieldDefinition) Equal

func (f FieldDefinition) Equal(u convert.Equaler) bool

Equal returns true if two FieldDefinition objects are equal; otherwise false is returned.

func (*FieldDefinition) UnmarshalJSON

func (f *FieldDefinition) UnmarshalJSON(bytes []byte) error

UnmarshalJSON implements encoding/json.Unmarshaler

type FieldDefinitions

type FieldDefinitions map[string]FieldDefinition

func (*FieldDefinitions) Scan

func (j *FieldDefinitions) Scan(src interface{}) error

func (FieldDefinitions) Value

func (j FieldDefinitions) Value() (driver.Value, error)

type FieldType

type FieldType interface {
	GetKind() Kind
	// ConvertToModel converts a field value for use in the persistence layer
	ConvertToModel(value interface{}) (interface{}, error)
	// ConvertFromModel converts a field value for use in the REST API layer
	ConvertFromModel(value interface{}) (interface{}, error)
	// Implement the Equaler interface
	Equal(u convert.Equaler) bool
}

FieldType describes the possible values of a FieldDefinition

type Fields

type Fields map[string]interface{}

func (Fields) Equal

func (f Fields) Equal(u convert.Equaler) bool

Equal returns true if two Fields objects are equal; otherwise false is returned. TODO: (kwk) think about a better comparison for Fields map.

func (*Fields) Scan

func (f *Fields) Scan(src interface{}) error

func (Fields) Value

func (f Fields) Value() (driver.Value, error)

type GormRevisionRepository

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

GormRevisionRepository implements RevisionRepository using gorm

func NewRevisionRepository

func NewRevisionRepository(db *gorm.DB) *GormRevisionRepository

NewRevisionRepository creates a GormRevisionRepository

func (*GormRevisionRepository) Create

func (r *GormRevisionRepository) Create(ctx context.Context, modifierID uuid.UUID, revisionType RevisionType, workitem WorkItemStorage) error

Create stores a new revision for the given work item.

func (*GormRevisionRepository) List

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

List retrieves all revisions for a given work item

type GormWorkItemRepository

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

GormWorkItemRepository implements WorkItemRepository using gorm

func NewWorkItemRepository

func NewWorkItemRepository(db *gorm.DB) *GormWorkItemRepository

NewWorkItemRepository creates a GormWorkItemRepository

func (*GormWorkItemRepository) CalculateOrder

func (r *GormWorkItemRepository) CalculateOrder(above, below *float64) float64

CalculateOrder calculates the order of the reorder workitem

func (*GormWorkItemRepository) CheckExists

func (r *GormWorkItemRepository) CheckExists(ctx context.Context, workitemID string) error

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

func (*GormWorkItemRepository) Count

func (r *GormWorkItemRepository) Count(ctx context.Context, spaceID uuid.UUID, criteria criteria.Expression) (int, error)

Count returns the amount of work item that satisfy the given criteria.Expression

func (*GormWorkItemRepository) Create

func (r *GormWorkItemRepository) Create(ctx context.Context, spaceID uuid.UUID, typeID uuid.UUID, fields map[string]interface{}, creatorID uuid.UUID) (*WorkItem, error)

Create creates a new work item in the repository returns BadParameterError, ConversionError or InternalError

func (*GormWorkItemRepository) CreateFromModel

func (r *GormWorkItemRepository) CreateFromModel(ctx context.Context, model *WorkItem, creatorID uuid.UUID) error

CreateFromModel creates a new work item in the repository returns BadParameterError, ConversionError or InternalError

func (*GormWorkItemRepository) Delete

func (r *GormWorkItemRepository) Delete(ctx context.Context, workitemID uuid.UUID, suppressorID uuid.UUID) error

Delete deletes the work item with the given id returns NotFoundError or InternalError

func (*GormWorkItemRepository) Fetch

func (r *GormWorkItemRepository) Fetch(ctx context.Context, spaceID uuid.UUID, criteria criteria.Expression) (*WorkItem, error)

Fetch fetches the (first) work item matching by the given criteria.Expression.

func (*GormWorkItemRepository) FindFirstItem

func (r *GormWorkItemRepository) FindFirstItem(ctx context.Context, spaceID uuid.UUID, id uuid.UUID) (*float64, error)

FindFirstItem returns the order of the target workitem

func (*GormWorkItemRepository) FindSecondItem

func (r *GormWorkItemRepository) FindSecondItem(ctx context.Context, order *float64, spaceID uuid.UUID, secondItemDirection DirectionType) (*uuid.UUID, *float64, error)

FindSecondItem returns the order of the second workitem required to reorder. Reordering a workitem requires order of two closest workitems: above and below. If direction == "above", then

	FindFirstItem returns the value above which reorder item has to be placed
     FindSecondItem returns the value below which reorder item has to be placed

If direction == "below", then

	FindFirstItem returns the value below which reorder item has to be placed
     FindSecondItem returns the value above which reorder item has to be placed

func (*GormWorkItemRepository) GetCountsForIteration

func (r *GormWorkItemRepository) GetCountsForIteration(ctx context.Context, itr *iteration.Iteration) (map[string]WICountsPerIteration, error)

GetCountsForIteration returns Closed and Total counts of WIs for given iteration It fetches all child iterations of input iteration and then uses list to counts work items SELECT count(*) AS Total,

count(CASE fields->>'system.state'
          WHEN 'closed' THEN '1'
          ELSE NULL
      END) AS Closed

FROM work_items wi WHERE fields->>'system.iteration' IN ('input iteration ID + children IDs')

AND wi.deleted_at IS NULL

func (*GormWorkItemRepository) GetCountsPerIteration

func (r *GormWorkItemRepository) GetCountsPerIteration(ctx context.Context, spaceID uuid.UUID) (map[string]WICountsPerIteration, error)

GetCountsPerIteration counts WIs including iteration-children and returns a map of iterationID->WICountsPerIteration

func (*GormWorkItemRepository) List

func (r *GormWorkItemRepository) List(ctx context.Context, spaceID uuid.UUID, criteria criteria.Expression, parentExists *bool, start *int, limit *int) ([]WorkItem, int, error)

List returns work item selected by the given criteria.Expression, starting with start (zero-based) and returning at most limit items

func (*GormWorkItemRepository) Load

func (r *GormWorkItemRepository) Load(ctx context.Context, spaceID uuid.UUID, wiNumber int) (*WorkItem, error)

Load returns the work item for the given spaceID and item id returns NotFoundError, ConversionError or InternalError

func (*GormWorkItemRepository) LoadBottomWorkitem

func (r *GormWorkItemRepository) LoadBottomWorkitem(ctx context.Context, spaceID uuid.UUID) (*WorkItem, error)

LoadBottomWorkitem returns bottom work item of the list. Bottom most workitem has the lowest order. returns NotFoundError, ConversionError or InternalError

func (*GormWorkItemRepository) LoadByID

func (r *GormWorkItemRepository) LoadByID(ctx context.Context, id uuid.UUID) (*WorkItem, error)

LoadByID returns the work item for the given id returns NotFoundError, ConversionError or InternalError

func (*GormWorkItemRepository) LoadFromDB

LoadFromDB returns the work item with the given natural ID in model representation.

func (*GormWorkItemRepository) LoadHighestOrder

func (r *GormWorkItemRepository) LoadHighestOrder(ctx context.Context, spaceID uuid.UUID) (float64, error)

LoadHighestOrder returns the highest execution order in the given space

func (*GormWorkItemRepository) LoadTopWorkitem

func (r *GormWorkItemRepository) LoadTopWorkitem(ctx context.Context, spaceID uuid.UUID) (*WorkItem, error)

LoadTopWorkitem returns top most work item of the list. Top most workitem has the Highest order. returns NotFoundError, ConversionError or InternalError

func (*GormWorkItemRepository) LookupIDByNamedSpaceAndNumber

func (r *GormWorkItemRepository) LookupIDByNamedSpaceAndNumber(ctx context.Context, ownerName, spaceName string, wiNumber int) (*uuid.UUID, *uuid.UUID, error)

LookupIDByNamedSpaceAndNumber returns the work item's ID for the given owner name, space name and item number returns NotFoundError, ConversionError or InternalError

func (*GormWorkItemRepository) Reorder

func (r *GormWorkItemRepository) Reorder(ctx context.Context, spaceID uuid.UUID, direction DirectionType, targetID *uuid.UUID, wi WorkItem, modifierID uuid.UUID) (*WorkItem, error)

Reorder places the to-be-reordered workitem above the input workitem. The order of workitems are spaced by a factor of 1000. The new order of workitem := (order of previousitem + order of nextitem)/2 Version must be the same as the one int the stored version

func (*GormWorkItemRepository) Save

func (r *GormWorkItemRepository) Save(ctx context.Context, spaceID uuid.UUID, updatedWorkItem WorkItem, modifierID uuid.UUID) (*WorkItem, error)

Save updates the given work item in storage. Version must be the same as the one int the stored version returns NotFoundError, VersionConflictError, ConversionError or InternalError

type GormWorkItemTypeRepository

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

GormWorkItemTypeRepository implements WorkItemTypeRepository using gorm

func NewWorkItemTypeRepository

func NewWorkItemTypeRepository(db *gorm.DB) *GormWorkItemTypeRepository

NewWorkItemTypeRepository creates a wi type repository based on gorm

func (*GormWorkItemTypeRepository) CheckExists

func (r *GormWorkItemTypeRepository) CheckExists(ctx context.Context, id string) error

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

func (*GormWorkItemTypeRepository) Create

func (r *GormWorkItemTypeRepository) Create(ctx context.Context, spaceID uuid.UUID, id *uuid.UUID, extendedTypeID *uuid.UUID, name string, description *string, icon string, fields map[string]FieldDefinition) (*WorkItemType, error)

Create creates a new work item type in the repository returns BadParameterError, ConversionError or InternalError

func (*GormWorkItemTypeRepository) CreateFromModel

func (r *GormWorkItemTypeRepository) CreateFromModel(ctx context.Context, model *WorkItemType) (*WorkItemType, error)

CreateFromModel creates a new work item type in the repository without any fancy stuff.

func (*GormWorkItemTypeRepository) List

func (r *GormWorkItemTypeRepository) List(ctx context.Context, spaceID uuid.UUID, start *int, limit *int) ([]WorkItemType, error)

List returns work item types selected by the given criteria.Expression, starting with start (zero-based) and returning at most "limit" item types.

func (*GormWorkItemTypeRepository) ListPlannerItems

func (r *GormWorkItemTypeRepository) ListPlannerItems(ctx context.Context, spaceID uuid.UUID) ([]WorkItemType, error)

List returns work item types that derives from PlannerItem type

func (*GormWorkItemTypeRepository) Load

Load returns the work item for the given spaceID and id returns NotFoundError, InternalError

func (*GormWorkItemTypeRepository) LoadByID

LoadByID returns the work item for the given id returns NotFoundError, InternalError

func (*GormWorkItemTypeRepository) LoadTypeFromDB

func (r *GormWorkItemTypeRepository) LoadTypeFromDB(ctx context.Context, id uuid.UUID) (*WorkItemType, error)

LoadTypeFromDB return work item type for the given id

type Kind

type Kind string

Kind is the kind of field type

const (
	KindString            Kind = "string"
	KindInteger           Kind = "integer"
	KindFloat             Kind = "float"
	KindInstant           Kind = "instant"
	KindDuration          Kind = "duration"
	KindURL               Kind = "url"
	KindIteration         Kind = "iteration"
	KindWorkitemReference Kind = "workitem"
	KindUser              Kind = "user"
	KindEnum              Kind = "enum"
	KindList              Kind = "list"
	KindMarkup            Kind = "markup"
	KindArea              Kind = "area"
	KindCodebase          Kind = "codebase"
)

constants for describing possible field types

func ConvertAnyToKind

func ConvertAnyToKind(any interface{}) (*Kind, error)

func ConvertStringToKind

func ConvertStringToKind(k string) (*Kind, error)

func (Kind) IsSimpleType

func (k Kind) IsSimpleType() bool

IsSimpleType returns 'true' if the kind is simple, i.e., not a list nor an enum

type ListType

type ListType struct {
	SimpleType
	ComponentType SimpleType
}

ListType describes a list of SimpleType values

func (ListType) ConvertFromModel

func (t ListType) ConvertFromModel(value interface{}) (interface{}, error)

ConvertFromModel implements the FieldType interface

func (ListType) ConvertToModel

func (t ListType) ConvertToModel(value interface{}) (interface{}, error)

ConvertToModel implements the FieldType interface

func (ListType) Equal

func (t ListType) Equal(u convert.Equaler) bool

Equal returns true if two ListType objects are equal; otherwise false is returned.

type Revision

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 workitem modification
	ModifierIdentity uuid.UUID `sql:"type:uuid" gorm:"column:modifier_id"`
	// the id of the work item that changed
	WorkItemID uuid.UUID `gorm:"column:work_item_id"`
	// Id of the type of this work item
	WorkItemTypeID uuid.UUID `gorm:"column:work_item_type_id"`
	// Version of the workitem that was modified
	WorkItemVersion int `gorm:"column:work_item_version"`
	// the field values (or empty when the work item was deleted)
	WorkItemFields Fields `gorm:"column:work_item_fields" sql:"type:jsonb"`
}

Revision represents a version of a work item

func (Revision) TableName

func (w Revision) TableName() string

TableName implements gorm.tabler

type RevisionRepository

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

RevisionRepository encapsulates storage & retrieval of historical versions of work items

type RevisionType

type RevisionType int

RevisionType defines the type of revision for a work item

const (

	// RevisionTypeCreate a work item creation
	RevisionTypeCreate RevisionType // 1
	// RevisionTypeDelete a work item deletion
	RevisionTypeDelete // 2

	// RevisionTypeUpdate a work item update
	RevisionTypeUpdate // 4
)

type SimpleType

type SimpleType struct {
	Kind Kind
}

SimpleType is an unstructured FieldType

func (SimpleType) ConvertFromModel

func (t SimpleType) ConvertFromModel(value interface{}) (interface{}, error)

ConvertFromModel implements the t interface

func (SimpleType) ConvertToModel

func (t SimpleType) ConvertToModel(value interface{}) (interface{}, error)

ConvertToModel implements the FieldType interface

func (SimpleType) Equal

func (t SimpleType) Equal(u convert.Equaler) bool

Equal returns true if two SimpleType objects are equal; otherwise false is returned.

func (SimpleType) GetKind

func (t SimpleType) GetKind() Kind

GetKind implements FieldType

type WICountsPerIteration

type WICountsPerIteration struct {
	IterationID string `gorm:"column:iterationid"`
	Total       int
	Closed      int
}

WICountsPerIteration counting work item states by iteration

type WorkItem

type WorkItem struct {
	// unique id per installation (used for references at the DB level)
	ID uuid.UUID
	// unique number per _space_
	Number int
	// ID of the type of this work item
	Type uuid.UUID
	// Version for optimistic concurrency control
	Version int
	// ID of the space to which this work item belongs
	SpaceID uuid.UUID
	// The field values, according to the field type
	Fields map[string]interface{}
	// contains filtered or unexported fields
}

WorkItem the model structure for the work item.

func ConvertWorkItemStorageToModel

func ConvertWorkItemStorageToModel(wiType *WorkItemType, wi *WorkItemStorage) (*WorkItem, error)

ConvertWorkItemStorageToModel convert work item model to app WI

func (WorkItem) GetETagData

func (wi WorkItem) GetETagData() []interface{}

GetETagData returns the field values to use to generate the ETag

func (WorkItem) GetLastModified

func (wi WorkItem) GetLastModified() time.Time

GetLastModified returns the last modification time

type WorkItemNumberSequence

type WorkItemNumberSequence struct {
	SpaceID    uuid.UUID `sql:"type:uuid" gorm:"primary_key"`
	CurrentVal int
}

WorkItemNumberSequence the sequence for work item numbers in a space

func (WorkItemNumberSequence) TableName

func (w WorkItemNumberSequence) TableName() string

TableName implements gorm.tabler

type WorkItemRepository

type WorkItemRepository interface {
	repository.Exister
	Load(ctx context.Context, spaceID uuid.UUID, wiNumber int) (*WorkItem, error)
	LoadByID(ctx context.Context, id uuid.UUID) (*WorkItem, error)
	LookupIDByNamedSpaceAndNumber(ctx context.Context, ownerName, spaceName string, wiNumber int) (*uuid.UUID, *uuid.UUID, error)
	Save(ctx context.Context, spaceID uuid.UUID, wi WorkItem, modifierID uuid.UUID) (*WorkItem, error)
	Reorder(ctx context.Context, spaceID uuid.UUID, direction DirectionType, targetID *uuid.UUID, wi WorkItem, modifierID uuid.UUID) (*WorkItem, error)
	Delete(ctx context.Context, id uuid.UUID, suppressorID uuid.UUID) error
	Create(ctx context.Context, spaceID uuid.UUID, typeID uuid.UUID, fields map[string]interface{}, creatorID uuid.UUID) (*WorkItem, error)
	CreateFromModel(ctx context.Context, wi *WorkItem, creatorID uuid.UUID) error
	List(ctx context.Context, spaceID uuid.UUID, criteria criteria.Expression, parentExists *bool, start *int, length *int) ([]WorkItem, int, error)
	Fetch(ctx context.Context, spaceID uuid.UUID, criteria criteria.Expression) (*WorkItem, error)
	GetCountsPerIteration(ctx context.Context, spaceID uuid.UUID) (map[string]WICountsPerIteration, error)
	GetCountsForIteration(ctx context.Context, itr *iteration.Iteration) (map[string]WICountsPerIteration, error)
	Count(ctx context.Context, spaceID uuid.UUID, criteria criteria.Expression) (int, error)
}

WorkItemRepository encapsulates storage & retrieval of work items

type WorkItemStorage

type WorkItemStorage struct {
	gormsupport.Lifecycle
	// unique id per installation (used for references at the DB level)
	ID uuid.UUID `sql:"type:uuid default uuid_generate_v4()" gorm:"primary_key"`
	// unique number per _space_
	Number int
	// Id of the type of this work item
	Type uuid.UUID `sql:"type:uuid"`
	// Version for optimistic concurrency control
	Version int
	// the field values
	Fields Fields `sql:"type:jsonb"`
	// the position of workitem
	ExecutionOrder float64
	// Reference to one Space
	SpaceID uuid.UUID `sql:"type:uuid"`
	// optional timestamp of the latest addition/removal of a relationship with this workitem
	RelationShipsChangedAt *time.Time `sql:"column:relationships_changed_at"`
}

WorkItemStorage represents a work item as it is stored in the database

func (WorkItemStorage) Equal

func (wi WorkItemStorage) Equal(u convert.Equaler) bool

Equal returns true if two WorkItem objects are equal; otherwise false is returned.

func (WorkItemStorage) TableName

func (wi WorkItemStorage) TableName() string

TableName implements gorm.tabler

type WorkItemType

type WorkItemType struct {
	gormsupport.Lifecycle
	// ID
	ID uuid.UUID `sql:"type:uuid default uuid_generate_v4()" gorm:"primary_key"`
	// Name is a human readable name of this work item type
	Name string
	// Description is an optional description of the work item type
	Description *string
	// The CSS icon class to render an icon for the WIT
	Icon string
	// Version for optimistic concurrency control
	Version int
	// the IDs of the parents, separated with a dot (".") separator
	Path string
	// definitions of the fields this work item type supports
	Fields FieldDefinitions `sql:"type:jsonb"`
	// Reference to one Space
	SpaceID uuid.UUID `sql:"type:uuid"`
}

WorkItemType represents a work item type as it is stored in the db

func (WorkItemType) ConvertWorkItemStorageToModel

func (wit WorkItemType) ConvertWorkItemStorageToModel(workItem WorkItemStorage) (*WorkItem, error)

ConvertWorkItemStorageToModel converts a workItem from the storage/persistence layer into a workItem of the model domain layer

func (WorkItemType) Equal

func (wit WorkItemType) Equal(u convert.Equaler) bool

Equal returns true if two WorkItemType objects are equal; otherwise false is returned.

func (WorkItemType) GetETagData

func (wit WorkItemType) GetETagData() []interface{}

GetETagData returns the field values to use to generate the ETag

func (WorkItemType) GetLastModified

func (wit WorkItemType) GetLastModified() time.Time

GetLastModified returns the last modification time

func (WorkItemType) IsTypeOrSubtypeOf

func (wit WorkItemType) IsTypeOrSubtypeOf(typeID uuid.UUID) bool

IsTypeOrSubtypeOf returns true if the work item type with the given type ID, is of the same type as the current WIT or of it is a subtype; otherwise false is returned.

func (WorkItemType) LtreeSafeID

func (wit WorkItemType) LtreeSafeID() string

LtreeSafeID returns the ID of the work item type in an postgres ltree safe manner. The returned string can be used as an ltree node.

func (WorkItemType) TableName

func (wit WorkItemType) TableName() string

TableName implements gorm.tabler

type WorkItemTypeCache

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

WorkItemTypeCache represents WorkItemType cache

func NewWorkItemTypeCache

func NewWorkItemTypeCache() *WorkItemTypeCache

NewWorkItemTypeCache constructs WorkItemTypeCache

func (*WorkItemTypeCache) Clear

func (c *WorkItemTypeCache) Clear()

Clear clears the cache

func (*WorkItemTypeCache) Get

Get returns WorkItemType by ID. The second value (ok) is a bool that is true if the WorkItemType exists in the cache, and false if not.

func (*WorkItemTypeCache) Put

func (c *WorkItemTypeCache) Put(wit WorkItemType)

Put puts a work item type to the cache

type WorkItemTypeRepository

type WorkItemTypeRepository interface {
	repository.Exister
	Load(ctx context.Context, spaceID uuid.UUID, id uuid.UUID) (*WorkItemType, error)
	Create(ctx context.Context, spaceID uuid.UUID, id *uuid.UUID, extendedTypeID *uuid.UUID, name string, description *string, icon string, fields map[string]FieldDefinition) (*WorkItemType, error)
	CreateFromModel(ctx context.Context, model *WorkItemType) (*WorkItemType, error)
	List(ctx context.Context, spaceID uuid.UUID, start *int, length *int) ([]WorkItemType, error)
	ListPlannerItems(ctx context.Context, spaceID uuid.UUID) ([]WorkItemType, error)
}

WorkItemTypeRepository encapsulates storage & retrieval of work item types

Directories

Path Synopsis
Package link contains the code that provides all the required operations to manage work item link, work item link types and work item link categories.
Package link contains the code that provides all the required operations to manage work item link, work item link types and work item link categories.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL