Documentation
¶
Overview ¶
Package application contains the code declaration of the necessary interfaces which hold the business logic of our application.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Transactional ¶
func Transactional(db DB, todo func(f Application) error) error
Transactional executes the given function in a transaction. If todo returns an error, the transaction is rolled back
Types ¶
type Application ¶
type Application interface { WorkItems() workitem.WorkItemRepository WorkItemTypes() workitem.WorkItemTypeRepository Trackers() TrackerRepository TrackerQueries() TrackerQueryRepository SearchItems() SearchRepository Identities() account.IdentityRepository WorkItemLinkCategories() link.WorkItemLinkCategoryRepository WorkItemLinkTypes() link.WorkItemLinkTypeRepository WorkItemLinks() link.WorkItemLinkRepository Comments() comment.Repository Spaces() space.Repository SpaceResources() space.ResourceRepository Iterations() iteration.Repository Users() account.UserRepository Areas() area.Repository OauthStates() auth.OauthStateReferenceRepository Codebases() codebase.Repository }
An Application stands for a particular implementation of the business logic of our application
type DB ¶
type DB interface { Application BeginTransaction() (Transaction, error) }
A DB stands for a particular database (or a mock/fake thereof). It also includes "Application" for creating transactionless repositories
type SearchRepository ¶
type SearchRepository interface {
SearchFullText(ctx context.Context, searchStr string, start *int, length *int, spaceID *string) ([]workitem.WorkItem, uint64, error)
}
SearchRepository encapsulates searching of woritems,users,etc
type TrackerQueryRepository ¶
type TrackerQueryRepository interface { Create(ctx context.Context, query string, schedule string, tracker string, spaceID uuid.UUID) (*app.TrackerQuery, error) Save(ctx context.Context, tq app.TrackerQuery) (*app.TrackerQuery, error) Load(ctx context.Context, ID string) (*app.TrackerQuery, error) Delete(ctx context.Context, ID string) error List(ctx context.Context) ([]*app.TrackerQuery, error) }
TrackerQueryRepository encapsulate storage & retrieval of tracker queries
type TrackerRepository ¶
type TrackerRepository interface { Load(ctx context.Context, ID string) (*app.Tracker, error) Save(ctx context.Context, t app.Tracker) (*app.Tracker, error) Delete(ctx context.Context, ID string) error Create(ctx context.Context, url string, typeID string) (*app.Tracker, error) List(ctx context.Context, criteria criteria.Expression, start *int, length *int) ([]*app.Tracker, error) }
TrackerRepository encapsulate storage & retrieval of tracker configuration
type Transaction ¶
type Transaction interface { Application Commit() error Rollback() error }
A Transaction abstracts a database transaction. The repositories created for the transaction object make changes inside the the transaction