application

package
v0.0.0-...-ef83997 Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

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 SetDatabaseTransactionTimeout

func SetDatabaseTransactionTimeout(t time.Duration)

SetDatabaseTransactionTimeout sets the global timeout variable to the given duration.

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() remoteworkitem.TrackerRepository
	TrackerQueries() remoteworkitem.TrackerQueryRepository
	SearchItems() SearchRepository
	Identities() account.IdentityRepository
	WorkItemLinkCategories() link.WorkItemLinkCategoryRepository
	WorkItemLinkTypes() link.WorkItemLinkTypeRepository
	WorkItemLinks() link.WorkItemLinkRepository
	Comments() comment.Repository
	Spaces() space.Repository
	Iterations() iteration.Repository
	Users() account.UserRepository
	Areas() area.Repository
	Codebases() codebase.Repository
	Labels() label.Repository
	Queries() query.Repository
	SpaceTemplates() spacetemplate.Repository
	WorkItemTypeGroups() workitem.WorkItemTypeGroupRepository
}

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, int, error)
	Filter(ctx context.Context, filterStr string, parentExists *bool, start *int, length *int) ([]workitem.WorkItem, int, link.AncestorList, link.WorkItemLinkList, error)
}

SearchRepository encapsulates searching of woritems,users,etc

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

Directories

Path Synopsis
Package repository contains interfaces used by our repositories.
Package repository contains interfaces used by our repositories.

Jump to

Keyboard shortcuts

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