issues

package
v4.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReplaceGlobals

func ReplaceGlobals(repository Repository) func()

ReplaceGlobals affect a new repository to the global repository singleton

Types

type PostgresRepository

type PostgresRepository struct {
	// contains filtered or unexported fields
}

PostgresRepository is a repository containing the Issue definition based on a PSQL database and implementing the repository interface

func (*PostgresRepository) ChangeState

func (r *PostgresRepository) ChangeState(key string, fromStates []models.IssueState, toState models.IssueState) error

ChangeState method used to change the issues state with key and created_date between from and to

func (*PostgresRepository) ChangeStateBetweenDates added in v4.1.3

func (r *PostgresRepository) ChangeStateBetweenDates(key string, fromStates []models.IssueState, toState models.IssueState, from time.Time, to time.Time) error

ChangeStateBetweenDates method used to change the issues state with key and created_date between from and to

func (*PostgresRepository) CountByKeyByPage added in v4.2.0

func (r *PostgresRepository) CountByKeyByPage(key string) (int, error)

CountByKeyByPage method used to count all issues

func (*PostgresRepository) CountByStateByPage

func (r *PostgresRepository) CountByStateByPage(issueStates []string) (int, error)

CountByStateByPage method used to count all issues

func (*PostgresRepository) CountByStateByPageBySituationIDs added in v4.2.0

func (r *PostgresRepository) CountByStateByPageBySituationIDs(issueStates []string, situationIDs []int64) (int, error)

CountByStateByPage method used to count all issues

func (*PostgresRepository) Create

func (r *PostgresRepository) Create(issue models.Issue) (int64, error)

Create method used to create an issue

func (*PostgresRepository) Get

func (r *PostgresRepository) Get(id int64) (models.Issue, bool, error)

Get use to retrieve an issue by id

func (*PostgresRepository) GetAll

func (r *PostgresRepository) GetAll() (map[int64]models.Issue, error)

GetAll method used to get all issues

func (*PostgresRepository) GetAllBySituationIDs added in v4.2.0

func (r *PostgresRepository) GetAllBySituationIDs(situationIDs []int64) (map[int64]models.Issue, error)

func (*PostgresRepository) GetByKeyByPage added in v4.2.0

func (r *PostgresRepository) GetByKeyByPage(key string, options models.SearchOptions) ([]models.Issue, int, error)

Get used to get issues by key

func (*PostgresRepository) GetByStateByPage

func (r *PostgresRepository) GetByStateByPage(issueStates []string, options models.SearchOptions) ([]models.Issue, int, error)

GetByStateByPage method used to get all issues

func (*PostgresRepository) GetByStateByPageBySituationIDs added in v4.2.0

func (r *PostgresRepository) GetByStateByPageBySituationIDs(issueStates []string, options models.SearchOptions, situationIDs []int64) ([]models.Issue, int, error)

GetByStateByPage method used to get all issues

func (*PostgresRepository) GetByStates

func (r *PostgresRepository) GetByStates(issueStates []string) (map[int64]models.Issue, error)

GetByStates method used to get all issues for an user

func (*PostgresRepository) GetByStatesBySituationIDs added in v4.2.0

func (r *PostgresRepository) GetByStatesBySituationIDs(issueStates []string, situationIDs []int64) (map[int64]models.Issue, error)

GetByStates method used to get all issues for an user

func (*PostgresRepository) GetCloseToTimeoutByKey

func (r *PostgresRepository) GetCloseToTimeoutByKey(key string, firstSituationTS time.Time) (map[int64]models.Issue, error)

GetCloseToTimeoutByKey get all issues that belong to the same situation and their creation time are within the timeout duration

func (*PostgresRepository) Update

func (r *PostgresRepository) Update(tx *sqlx.Tx, id int64, issue models.Issue, user users.User) error

Update method used to update an issue

func (*PostgresRepository) UpdateComment added in v4.1.3

func (r *PostgresRepository) UpdateComment(dbClient *sqlx.DB, id int64, comment string) error

UpdateComment method used to update an issue

type Repository

type Repository interface {
	Get(id int64) (models.Issue, bool, error)
	Create(issue models.Issue) (int64, error)

	Update(tx *sqlx.Tx, id int64, issue models.Issue, user users.User) error
	UpdateComment(dbClient *sqlx.DB, id int64, comment string) error
	GetAll() (map[int64]models.Issue, error)
	GetAllBySituationIDs(situationIDs []int64) (map[int64]models.Issue, error)
	GetByStates(issueStates []string) (map[int64]models.Issue, error)
	GetByStatesBySituationIDs(issueStates []string, situationIDs []int64) (map[int64]models.Issue, error)
	GetByStateByPage(issuesStates []string, options models.SearchOptions) ([]models.Issue, int, error)
	GetByStateByPageBySituationIDs(issuesStates []string, options models.SearchOptions, situationIDs []int64) ([]models.Issue, int, error)
	GetByKeyByPage(key string, options models.SearchOptions) ([]models.Issue, int, error)

	GetCloseToTimeoutByKey(key string, firstSituationTS time.Time) (map[int64]models.Issue, error)

	ChangeState(key string, fromStates []models.IssueState, toState models.IssueState) error
	ChangeStateBetweenDates(key string, fromStates []models.IssueState, toState models.IssueState, from time.Time, to time.Time) error
}

Repository is a storage interface which can be implemented by multiple backend (in-memory map, sql database, in-memory cache, file system, ...) It allows standard CRUD operation on Issues

func NewPostgresRepository

func NewPostgresRepository(dbClient *sqlx.DB) Repository

NewPostgresRepository returns a new instance of PostgresRepository

func R

func R() Repository

R is used to access the global repository singleton

Jump to

Keyboard shortcuts

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