repository

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(
	client *sql.DB,
	appInstanceId string,
	eh contracts.EventHandlerInterface,
	options *Options,
) contracts.RepositoryInterface

Types

type Collections

type Collections struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*Collections) Next

func (c *Collections) Next(ctx context.Context) ([]domain.Task, error)

type CollectionsMock

type CollectionsMock struct {
	contracts.CollectionsInterface
	NextMock func(ctx context.Context) (tasks []domain.Task, err error)
}

func (*CollectionsMock) Next

func (c *CollectionsMock) Next(ctx context.Context) (tasks []domain.Task, err error)

type Options

type Options struct {
	/*
		It is approximately count of tasks in collection
	*/
	MaxCountTasksInCollection int

	/*
		0 - disable deleting empty collections
		1 - delete empty collection each times
		n - delete empty collections every n times
	*/
	CleaningFrequency int
}

type RepositoryMock

type RepositoryMock struct {
	contracts.RepositoryInterface

	/*
		You need to substitute *Mock methods to do substitute original functions
	*/
	CreateMock              func(ctx context.Context, task domain.Task, isTaken bool) error
	DeleteMock              func(ctx context.Context, tasks []domain.Task) (int64, error)
	FindBySecToExecTimeMock func(ctx context.Context, preloadingTimeRange time.Duration) (contracts.CollectionsInterface, error)
	UpMock                  func() error
	CountMock               func() (int, error)
}

func (*RepositoryMock) Count

func (r *RepositoryMock) Count() (int, error)

func (*RepositoryMock) Create

func (r *RepositoryMock) Create(ctx context.Context, task domain.Task, isTaken bool) error

func (*RepositoryMock) Delete

func (r *RepositoryMock) Delete(ctx context.Context, tasks []domain.Task) (int64, error)

func (*RepositoryMock) FindBySecToExecTime

func (r *RepositoryMock) FindBySecToExecTime(ctx context.Context, preloadingTimeRange time.Duration) (
	collection contracts.CollectionsInterface,
	error error,
)

func (*RepositoryMock) Up

func (r *RepositoryMock) Up() (error error)

Jump to

Keyboard shortcuts

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