issues

package
v4.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 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) CountByStateByPage

func (r *PostgresRepository) CountByStateByPage(issueStates []string, groups []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, groups []int64) (models.Issue, bool, error)

Get use to retrieve an issue by id

func (*PostgresRepository) GetAll

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

GetAll method used to get all issues

func (*PostgresRepository) GetByStateByPage

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

GetByStateByPage method used to get all issues

func (*PostgresRepository) GetByStates

func (r *PostgresRepository) GetByStates(issueStates []string, groups []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 groups.UserWithGroups) 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, user groups.UserWithGroups) error

UpdateComment method used to update an issue

type Repository

type Repository interface {
	Get(id int64, groups []int64) (models.Issue, bool, error)
	Create(issue models.Issue) (int64, error)
	Update(tx *sqlx.Tx, id int64, issue models.Issue, user groups.UserWithGroups) error
	UpdateComment(dbClient *sqlx.DB, id int64, comment string, user groups.UserWithGroups) error
	GetByStates(issueStates []string, groups []int64) (map[int64]models.Issue, error)
	GetByStateByPage(issuesStates []string, options models.SearchOptions, groups []int64) ([]models.Issue, int, error)
	GetCloseToTimeoutByKey(key string, firstSituationTS time.Time) (map[int64]models.Issue, error)
	GetAll(groups []int64) (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