Documentation ¶
Index ¶
- Constants
- Variables
- func Flatten(source map[string]interface{}) map[string]interface{}
- func Map(item AttributeAccessor, mapping WorkItemMap) (app.WorkItem, error)
- type AttributeAccessor
- type AttributeConverter
- type AttributeExpression
- type AttributeMapper
- type BadParameterError
- type ConversionError
- type GitHubRemoteWorkItem
- type GithubStateConverter
- type GithubTracker
- type GormTrackerQueryRepository
- func (r *GormTrackerQueryRepository) Create(ctx context.Context, query string, schedule string, tracker string) (*app.TrackerQuery, error)
- func (r *GormTrackerQueryRepository) Delete(ctx context.Context, ID string) error
- func (r *GormTrackerQueryRepository) List(ctx context.Context) ([]*app.TrackerQuery, error)
- func (r *GormTrackerQueryRepository) Load(ctx context.Context, ID string) (*app.TrackerQuery, error)
- func (r *GormTrackerQueryRepository) Save(ctx context.Context, tq app.TrackerQuery) (*app.TrackerQuery, error)
- type GormTrackerRepository
- func (r *GormTrackerRepository) Create(ctx context.Context, url string, typeID string) (*app.Tracker, error)
- func (r *GormTrackerRepository) Delete(ctx context.Context, ID string) error
- func (r *GormTrackerRepository) List(ctx context.Context, criteria criteria.Expression, start *int, limit *int) ([]*app.Tracker, error)
- func (r *GormTrackerRepository) Load(ctx context.Context, ID string) (*app.Tracker, error)
- func (r *GormTrackerRepository) Save(ctx context.Context, t app.Tracker) (*app.Tracker, error)
- type InternalError
- type JiraRemoteWorkItem
- type JiraStateConverter
- type JiraTracker
- type NotFoundError
- type Scheduler
- type StateConverter
- type StringConverter
- type Tracker
- type TrackerItem
- type TrackerItemContent
- type TrackerProvider
- type TrackerQuery
- type VersionConflictError
- type WorkItemMap
Constants ¶
const ( SystemRemoteItemID = "system.remote_item_id" SystemTitle = "system.title" SystemDescription = "system.description" SystemState = "system.state" SystemAssignee = "system.assignee" SystemCreator = "system.creator" GithubTitle = "title" GithubDescription = "body" GithubState = "state" GithubID = "url" GithubCreator = "user.login" GithubAssignee = "assignee.login" JiraTitle = "fields.summary" JiraBody = "fields.description" JiraState = "fields.status.name" JiraID = "self" JiraCreator = "fields.creator.key" JiraAssignee = "fields.assignee" ProviderGithub = "github" ProviderJira = "jira" )
List of supported attributes
Variables ¶
var RemoteWorkItemImplRegistry = map[string]func(TrackerItem) (AttributeAccessor, error){ ProviderGithub: NewGitHubRemoteWorkItem, ProviderJira: NewJiraRemoteWorkItem, }
RemoteWorkItemImplRegistry contains all possible providers
var WorkItemKeyMaps = map[string]WorkItemMap{ ProviderGithub: WorkItemMap{ AttributeMapper{AttributeExpression(GithubTitle), StringConverter{}}: models.SystemTitle, AttributeMapper{AttributeExpression(GithubDescription), StringConverter{}}: models.SystemDescription, AttributeMapper{AttributeExpression(GithubState), GithubStateConverter{}}: models.SystemState, AttributeMapper{AttributeExpression(GithubID), StringConverter{}}: models.SystemRemoteItemID, AttributeMapper{AttributeExpression(GithubCreator), StringConverter{}}: models.SystemCreator, AttributeMapper{AttributeExpression(GithubAssignee), StringConverter{}}: models.SystemAssignee, }, ProviderJira: WorkItemMap{ AttributeMapper{AttributeExpression(JiraTitle), StringConverter{}}: models.SystemTitle, AttributeMapper{AttributeExpression(JiraBody), StringConverter{}}: models.SystemDescription, AttributeMapper{AttributeExpression(JiraState), JiraStateConverter{}}: models.SystemState, AttributeMapper{AttributeExpression(JiraID), StringConverter{}}: models.SystemRemoteItemID, AttributeMapper{AttributeExpression(JiraCreator), StringConverter{}}: models.SystemCreator, AttributeMapper{AttributeExpression(JiraAssignee), StringConverter{}}: models.SystemAssignee, }, }
WorkItemKeyMaps relate remote attribute keys to internal representation
Functions ¶
func Map ¶
func Map(item AttributeAccessor, mapping WorkItemMap) (app.WorkItem, error)
Map maps the remote WorkItem to a local WorkItem
Types ¶
type AttributeAccessor ¶
type AttributeAccessor interface { // Get returns the value based on a commonly understood attribute expression Get(field AttributeExpression) interface{} }
AttributeAccessor defines the interface between a RemoteWorkItem and the Mapper
func NewGitHubRemoteWorkItem ¶
func NewGitHubRemoteWorkItem(item TrackerItem) (AttributeAccessor, error)
NewGitHubRemoteWorkItem creates a new Decoded AttributeAccessor for a GitHub Issue
func NewJiraRemoteWorkItem ¶
func NewJiraRemoteWorkItem(item TrackerItem) (AttributeAccessor, error)
NewJiraRemoteWorkItem creates a new Decoded AttributeAccessor for a GitHub Issue
type AttributeConverter ¶
type AttributeConverter interface {
Convert(interface{}, AttributeAccessor) (interface{}, error)
}
type AttributeExpression ¶
type AttributeExpression string
AttributeExpression represents a commonly understood String format for a target path
type AttributeMapper ¶
type AttributeMapper struct {
// contains filtered or unexported fields
}
type BadParameterError ¶
type BadParameterError struct {
// contains filtered or unexported fields
}
BadParameterError means that a parameter was not as required
func (BadParameterError) Error ¶
func (err BadParameterError) Error() string
Error implements the error interface
type ConversionError ¶
type ConversionError struct {
// contains filtered or unexported fields
}
ConversionError error means something went wrong converting between different representations
type GitHubRemoteWorkItem ¶
type GitHubRemoteWorkItem struct {
// contains filtered or unexported fields
}
GitHubRemoteWorkItem knows how to implement a FieldAccessor on a GitHub Issue JSON struct and it should also know how to convert a value in remote work item for use in local WI
func (GitHubRemoteWorkItem) Get ¶
func (gh GitHubRemoteWorkItem) Get(field AttributeExpression) interface{}
Get attribute from issue map
type GithubStateConverter ¶
type GithubStateConverter struct{}
func (GithubStateConverter) Convert ¶
func (ghc GithubStateConverter) Convert(value interface{}, item AttributeAccessor) (interface{}, error)
type GithubTracker ¶
GithubTracker represents the Github tracker provider
func (*GithubTracker) Fetch ¶
func (g *GithubTracker) Fetch() chan TrackerItemContent
Fetch tracker items from Github
type GormTrackerQueryRepository ¶
type GormTrackerQueryRepository struct {
// contains filtered or unexported fields
}
GormTrackerQueryRepository implements TrackerRepository using gorm
func NewTrackerQueryRepository ¶
func NewTrackerQueryRepository(db *gorm.DB) *GormTrackerQueryRepository
NewTrackerQueryRepository constructs a TrackerQueryRepository
func (*GormTrackerQueryRepository) Create ¶
func (r *GormTrackerQueryRepository) Create(ctx context.Context, query string, schedule string, tracker string) (*app.TrackerQuery, error)
Create creates a new tracker query in the repository returns BadParameterError, ConversionError or InternalError
func (*GormTrackerQueryRepository) Delete ¶
func (r *GormTrackerQueryRepository) Delete(ctx context.Context, ID string) error
Delete deletes the tracker query with the given id returns NotFoundError or InternalError
func (*GormTrackerQueryRepository) List ¶
func (r *GormTrackerQueryRepository) List(ctx context.Context) ([]*app.TrackerQuery, error)
List returns tracker query selected by the given criteria.Expression, starting with start (zero-based) and returning at most limit items
func (*GormTrackerQueryRepository) Load ¶
func (r *GormTrackerQueryRepository) Load(ctx context.Context, ID string) (*app.TrackerQuery, error)
Load returns the tracker query for the given id returns NotFoundError, ConversionError or InternalError
func (*GormTrackerQueryRepository) Save ¶
func (r *GormTrackerQueryRepository) Save(ctx context.Context, tq app.TrackerQuery) (*app.TrackerQuery, error)
Save updates the given tracker query in storage. returns NotFoundError, ConversionError or InternalError
type GormTrackerRepository ¶
type GormTrackerRepository struct {
// contains filtered or unexported fields
}
GormTrackerRepository implements TrackerRepository using gorm
func NewTrackerRepository ¶
func NewTrackerRepository(db *gorm.DB) *GormTrackerRepository
NewTrackerRepository constructs a TrackerRepository
func (*GormTrackerRepository) Create ¶
func (r *GormTrackerRepository) Create(ctx context.Context, url string, typeID string) (*app.Tracker, error)
Create creates a new tracker configuration in the repository returns BadParameterError, ConversionError or InternalError
func (*GormTrackerRepository) Delete ¶
func (r *GormTrackerRepository) Delete(ctx context.Context, ID string) error
Delete deletes the tracker with the given id returns NotFoundError or InternalError
func (*GormTrackerRepository) List ¶
func (r *GormTrackerRepository) List(ctx context.Context, criteria criteria.Expression, start *int, limit *int) ([]*app.Tracker, error)
List returns tracker selected by the given criteria.Expression, starting with start (zero-based) and returning at most limit items
type InternalError ¶
type InternalError struct {
// contains filtered or unexported fields
}
InternalError means that the operation failed for some internal, unexpected reason
type JiraRemoteWorkItem ¶
type JiraRemoteWorkItem struct {
// contains filtered or unexported fields
}
JiraRemoteWorkItem knows how to implement a FieldAccessor on a Jira Issue JSON struct
func (JiraRemoteWorkItem) Get ¶
func (jira JiraRemoteWorkItem) Get(field AttributeExpression) interface{}
Get attribute from issue map
type JiraStateConverter ¶
type JiraStateConverter struct{}
func (JiraStateConverter) Convert ¶
func (jhc JiraStateConverter) Convert(value interface{}, item AttributeAccessor) (interface{}, error)
type JiraTracker ¶
JiraTracker represents the Jira tracker provider
func (*JiraTracker) Fetch ¶
func (j *JiraTracker) Fetch() chan TrackerItemContent
Fetch collects data from Jira
type NotFoundError ¶
type NotFoundError struct { ID string // contains filtered or unexported fields }
NotFoundError means the object specified for the operation does not exist
func (NotFoundError) Error ¶
func (err NotFoundError) Error() string
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler represents scheduler
func (*Scheduler) ScheduleAllQueries ¶
func (s *Scheduler) ScheduleAllQueries()
ScheduleAllQueries fetch and import of remote tracker items
type StateConverter ¶
type StateConverter interface{}
type StringConverter ¶
type StringConverter struct{}
func (StringConverter) Convert ¶
func (sc StringConverter) Convert(value interface{}, item AttributeAccessor) (interface{}, error)
Convert method map the external tracker item to ALM WorkItem
type Tracker ¶
type Tracker struct { gormsupport.Lifecycle ID uint64 `gorm:"primary_key"` // URL of the tracker URL string // Type of the tracker (jira, github, bugzilla, trello etc.) Type string }
Tracker represents tracker configuration
type TrackerItem ¶
type TrackerItem struct { gormsupport.Lifecycle ID uint64 `gorm:"primary_key"` // Remote item ID - unique across multiple trackers RemoteItemID string `gorm:"not null;unique"` // the field values Item string // FK to tracker TrackerID uint64 `gorm:"ForeignKey:Tracker"` }
TrackerItem represents a remote tracker item Staging area before pushing to work item
type TrackerItemContent ¶
TrackerItemContent represents a remote tracker item with it's content and unique ID
type TrackerProvider ¶
type TrackerProvider interface {
Fetch() chan TrackerItemContent // TODO: Change to an interface to enforce the contract
}
TrackerProvider represents a remote tracker
type TrackerQuery ¶
type TrackerQuery struct { gormsupport.Lifecycle ID uint64 `gorm:"primary_key"` // Search query of the tracker Query string // Schedule to fetch and import remote tracker items Schedule string // TrackerID is a foreign key for a tracker TrackerID uint64 `gorm:"ForeignKey:Tracker"` }
TrackerQuery represents tracker query
type VersionConflictError ¶
type VersionConflictError struct {
// contains filtered or unexported fields
}
VersionConflictError means that the version was not as expected in an update operation
type WorkItemMap ¶
type WorkItemMap map[AttributeMapper]string
WorkItemMap will define mappings between remote<->internal attribute