Documentation ¶
Overview ¶
Package importer provides functions to help import a space template YAML definition into the system. It is separated from the main space template package because it pulls in a lot of other packages that might themselves need to import the spacetemplate package which would cause an import cycle if the importer was in the spacetemplate package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GormRepository ¶
type GormRepository struct {
// contains filtered or unexported fields
}
GormRepository is the implementation of the repository interface for importer.
func (*GormRepository) Import ¶
func (r *GormRepository) Import(ctx context.Context, s ImportHelper) (*ImportHelper, error)
Import creates a new space template and all the artifacts (e.g. work item types, work item link types) in the system. In case a space template or a work item exists, we will update its description, label, icon, title. We don't touch the work item type fields or IDs of any kind.
type ImportHelper ¶
type ImportHelper struct { Template spacetemplate.SpaceTemplate `json:"space_template"` WITs []*workitem.WorkItemType `gorm:"-" json:"work_item_types,omitempty"` WILTs []*link.WorkItemLinkType `gorm:"-" json:"work_item_link_types,omitempty"` WITGs []*workitem.WorkItemTypeGroup `gorm:"-" json:"work_item_type_groups,omitempty"` }
ImportHelper is a type to allow creation of space templates from a YAML file.
func BaseTemplate ¶
func BaseTemplate() (*ImportHelper, error)
BaseTemplate returns the base template
func FromString ¶
func FromString(templ string) (*ImportHelper, error)
FromString parses a given string into a parsed template object and validates it.
func LegacyTemplate ¶
func LegacyTemplate() (*ImportHelper, error)
LegacyTemplate returns the legacy template as it is known to the system
func ScrumTemplate ¶
func ScrumTemplate() (*ImportHelper, error)
ScrumTemplate returns the scrum template as it is known to the system
func (ImportHelper) Equal ¶
func (s ImportHelper) Equal(u convert.Equaler) bool
Equal returns true if two ImportHelper objects are equal; otherwise false is returned.
func (*ImportHelper) SetID ¶
func (s *ImportHelper) SetID(id uuid.UUID)
SetID updates the space templates IDs and updates the references to that ID.
func (ImportHelper) String ¶
func (s ImportHelper) String() string
String convert a parsed template into a string in YAML format
func (*ImportHelper) Validate ¶
func (s *ImportHelper) Validate() error
Validate ensures that all inner-document references of the given space template are fine.
type Repository ¶
type Repository interface { // Import creates a new space template and all the artifacts (e.g. // work item types, work item link types) in the system. In case a space // template or a work item exists, we will update its description, label, // icon, title. We don't touch the work item type fields or IDs of any kind. Import(ctx context.Context, template ImportHelper) (*ImportHelper, error) }
Repository describes interactions with space templates
func NewRepository ¶
func NewRepository(db *gorm.DB) Repository
NewRepository creates a new importer repository