Documentation ¶
Overview ¶
Package iteration provides all the required functions to manage the iterations over the work items.
Index ¶
- Constants
- type GormIterationRepository
- func (m *GormIterationRepository) CanStart(ctx context.Context, i *Iteration) (bool, error)
- func (m *GormIterationRepository) CheckExists(ctx context.Context, id string) error
- func (m *GormIterationRepository) Create(ctx context.Context, u *Iteration) error
- func (m *GormIterationRepository) List(ctx context.Context, spaceID uuid.UUID) ([]Iteration, error)
- func (m *GormIterationRepository) Load(ctx context.Context, id uuid.UUID) (*Iteration, error)
- func (m *GormIterationRepository) LoadChildren(ctx context.Context, parentIterationID uuid.UUID) ([]Iteration, error)
- func (m *GormIterationRepository) LoadMultiple(ctx context.Context, ids []uuid.UUID) ([]Iteration, error)
- func (m *GormIterationRepository) Root(ctx context.Context, spaceID uuid.UUID) (*Iteration, error)
- func (m *GormIterationRepository) Save(ctx context.Context, i Iteration) (*Iteration, error)
- type Iteration
- type Repository
Constants ¶
const ( APIStringTypeIteration = "iterations" IterationStateNew = "new" IterationStateStart = "start" IterationStateClose = "close" PathSepInService = "/" PathSepInDatabase = "." IterationActive = true IterationNotActive = false )
Defines "type" string to be used while validating jsonapi spec based payload
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GormIterationRepository ¶
type GormIterationRepository struct {
// contains filtered or unexported fields
}
GormIterationRepository is the implementation of the storage interface for Iterations.
func (*GormIterationRepository) CanStart ¶
CanStart checks the rule - 1. Only one iteration from a space can have state=start at a time. 2. Root iteration of the space can not be started.(Hence can not be closed - via UI) Currently there is no State-machine for state transitions of iteraitons till then we will not allow user to start root iteration. More rules can be added as needed in this function
func (*GormIterationRepository) CheckExists ¶
func (m *GormIterationRepository) CheckExists(ctx context.Context, id string) error
CheckExists returns nil if the given ID exists otherwise returns an error
func (*GormIterationRepository) Create ¶
func (m *GormIterationRepository) Create(ctx context.Context, u *Iteration) error
Create creates a new record.
func (*GormIterationRepository) LoadChildren ¶
func (m *GormIterationRepository) LoadChildren(ctx context.Context, parentIterationID uuid.UUID) ([]Iteration, error)
LoadChildren executes - select * from iterations where path <@ 'parent_path.parent_id';
func (*GormIterationRepository) LoadMultiple ¶
func (m *GormIterationRepository) LoadMultiple(ctx context.Context, ids []uuid.UUID) ([]Iteration, error)
LoadMultiple returns multiple instances of iteration.Iteration
type Iteration ¶
type Iteration struct { gormsupport.Lifecycle ID uuid.UUID `sql:"type:uuid default uuid_generate_v4()" gorm:"primary_key"` // This is the ID PK field SpaceID uuid.UUID `sql:"type:uuid"` Path path.Path StartAt *time.Time EndAt *time.Time Name string Description *string State string // this tells if iteration is currently running or not UserActive *bool // optional, private timestamp of the latest addition/removal of a relationship with this iteration // this field is used to generate the `ETag` and `Last-Modified` values in the HTTP responses and conditional requests processing RelationShipsChangedAt *time.Time `sql:"column:relationships_changed_at"` }
Iteration describes a single iteration
func (Iteration) GetETagData ¶
func (m Iteration) GetETagData() []interface{}
GetETagData returns the field values to use to generate the ETag
func (Iteration) GetLastModified ¶
GetLastModified returns the last modification time
type Repository ¶
type Repository interface { repository.Exister Create(ctx context.Context, u *Iteration) error List(ctx context.Context, spaceID uuid.UUID) ([]Iteration, error) Root(ctx context.Context, spaceID uuid.UUID) (*Iteration, error) Load(ctx context.Context, id uuid.UUID) (*Iteration, error) Save(ctx context.Context, i Iteration) (*Iteration, error) CanStart(ctx context.Context, i *Iteration) (bool, error) LoadMultiple(ctx context.Context, ids []uuid.UUID) ([]Iteration, error) LoadChildren(ctx context.Context, parentIterationID uuid.UUID) ([]Iteration, error) }
Repository describes interactions with Iterations
func NewIterationRepository ¶
func NewIterationRepository(db *gorm.DB) Repository
NewIterationRepository creates a new storage type.