db

package
v0.0.0-...-c07ec26 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package db is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JobsStore

type JobsStore interface {
	Update(ctx context.Context, job jobs.Job) error
	Create(ctx context.Context, job jobs.Job) error
	Deschedule(ctx context.Context, id string) error
	ScheduleNow(ctx context.Context, id string) error
	Search(ctx context.Context, limit, offset int, search string) ([]jobs.Job, error)
	Get(ctx context.Context, id string) (jobs.Job, error)
	GetStatistics(ctx context.Context) (Statistics, error)
}

type MockJobsStore

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

MockJobsStore is a mock of JobsStore interface.

func NewMockJobsStore

func NewMockJobsStore(ctrl *gomock.Controller) *MockJobsStore

NewMockJobsStore creates a new mock instance.

func (*MockJobsStore) Create

func (m *MockJobsStore) Create(ctx context.Context, job jobs.Job) error

Create mocks base method.

func (*MockJobsStore) Deschedule

func (m *MockJobsStore) Deschedule(ctx context.Context, id string) error

Deschedule mocks base method.

func (*MockJobsStore) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockJobsStore) Get

func (m *MockJobsStore) Get(ctx context.Context, id string) (jobs.Job, error)

Get mocks base method.

func (*MockJobsStore) ScheduleNow

func (m *MockJobsStore) ScheduleNow(ctx context.Context, id string) error

ScheduleNow mocks base method.

func (*MockJobsStore) Search

func (m *MockJobsStore) Search(ctx context.Context, limit, offset int, search string) ([]jobs.Job, error)

Search mocks base method.

func (*MockJobsStore) Update

func (m *MockJobsStore) Update(ctx context.Context, job jobs.Job) error

Update mocks base method.

type MockJobsStoreMockRecorder

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

MockJobsStoreMockRecorder is the mock recorder for MockJobsStore.

func (*MockJobsStoreMockRecorder) Create

func (mr *MockJobsStoreMockRecorder) Create(ctx, job interface{}) *gomock.Call

Create indicates an expected call of Create.

func (*MockJobsStoreMockRecorder) Deschedule

func (mr *MockJobsStoreMockRecorder) Deschedule(ctx, id interface{}) *gomock.Call

Deschedule indicates an expected call of Deschedule.

func (*MockJobsStoreMockRecorder) Get

func (mr *MockJobsStoreMockRecorder) Get(ctx, id interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockJobsStoreMockRecorder) ScheduleNow

func (mr *MockJobsStoreMockRecorder) ScheduleNow(ctx, id interface{}) *gomock.Call

ScheduleNow indicates an expected call of ScheduleNow.

func (*MockJobsStoreMockRecorder) Search

func (mr *MockJobsStoreMockRecorder) Search(ctx, limit, offset, search interface{}) *gomock.Call

Search indicates an expected call of Search.

func (*MockJobsStoreMockRecorder) Update

func (mr *MockJobsStoreMockRecorder) Update(ctx, job interface{}) *gomock.Call

Update indicates an expected call of Update.

type Queue

type Queue struct {
	TxWrapper
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue(db *sql.DB, name string) *Queue

func (*Queue) Poll

func (q *Queue) Poll(ctx context.Context) (jobs.Job, error)

func (*Queue) RequeueTimedOutJobs

func (q *Queue) RequeueTimedOutJobs(ctx context.Context, timeout time.Duration) error

type QueueStatistics

type QueueStatistics struct {
	Name        string             `json:"name"`
	Scheduled   int                `json:"scheduled"`
	Initialized int                `json:"initialized"`
	Failed      int                `json:"failed"`
	Completed   int                `json:"completed"`
	Workers     []WorkerStatistics `json:"workers"`
}

type Statistics

type Statistics struct {
	Queues []QueueStatistics `json:"queues"`
}

type Store

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

func NewStore

func NewStore(db *sql.DB) *Store

func (*Store) Create

func (s *Store) Create(ctx context.Context, job jobs.Job) error

Create the job in the database

func (*Store) Deschedule

func (s *Store) Deschedule(ctx context.Context, id string) error

Deschedule the job

func (*Store) Get

func (s *Store) Get(ctx context.Context, id string) (jobs.Job, error)

func (*Store) GetStatistics

func (s *Store) GetStatistics(ctx context.Context) (Statistics, error)

func (*Store) ScheduleNow

func (s *Store) ScheduleNow(ctx context.Context, id string) error

ScheduleNow the job

func (*Store) Search

func (s *Store) Search(ctx context.Context, limit, offset int, search string) ([]jobs.Job, error)

func (*Store) Update

func (s *Store) Update(ctx context.Context, job jobs.Job) error

Update the job in the database

type Tx

type Tx struct {
	*sql.Tx
}

func (*Tx) Create

func (tx *Tx) Create(ctx context.Context, job jobs.Job) error

Create the job in the database

func (*Tx) Deschedule

func (tx *Tx) Deschedule(ctx context.Context, id string) error

Deschedule the job

func (*Tx) Get

func (tx *Tx) Get(ctx context.Context, id string) (jobs.Job, error)

func (*Tx) ScheduleNow

func (tx *Tx) ScheduleNow(ctx context.Context, id string) error

ScheduleNow the job

func (*Tx) Search

func (tx *Tx) Search(ctx context.Context, limit, offset int, search string) ([]jobs.Job, error)

func (*Tx) Update

func (tx *Tx) Update(ctx context.Context, job jobs.Job) error

Update the job in the database

type TxStore

type TxStore interface {
	Search(ctx context.Context, limit int, offset int, search string) ([]jobs.Job, error)
	Get(ctx context.Context, id string) (jobs.Job, error)
	Update(ctx context.Context, job jobs.Job) error
	Create(ctx context.Context, job jobs.Job) error
	Deschedule(ctx context.Context, id string) error
	ScheduleNow(ctx context.Context, id string) error
	Commit() error
}

func NewTx

func NewTx(tx *sql.Tx) TxStore

type TxWrapper

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

func NewTxWrapper

func NewTxWrapper(db *sql.DB) TxWrapper

func (TxWrapper) WrapTx

func (w TxWrapper) WrapTx(ctx context.Context, f func(ctx context.Context, tx *sql.Tx) (interface{}, error)) (interface{}, error)

type WorkerStatistics

type WorkerStatistics struct {
	ID         string    `json:"id"`
	LastSeenAt time.Time `json:"last_seen_at"`
}

Jump to

Keyboard shortcuts

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