datahistoryjob

package
v0.0.0-...-ae86ed1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBService

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

DBService is a service which allows the interaction with the database without a direct reference to a global

func Setup

func Setup(db database.IDatabase) (*DBService, error)

Setup returns a DBService

func (*DBService) GetAllIncompleteJobsAndResults

func (db *DBService) GetAllIncompleteJobsAndResults() ([]DataHistoryJob, error)

GetAllIncompleteJobsAndResults returns all jobs that have the status "active"

func (*DBService) GetByID

func (db *DBService) GetByID(id string) (*DataHistoryJob, error)

GetByID returns a job by its id

func (*DBService) GetByNickName

func (db *DBService) GetByNickName(nickname string) (*DataHistoryJob, error)

GetByNickName returns a job by its nickname

func (*DBService) GetJobAndAllResults

func (db *DBService) GetJobAndAllResults(nickname string) (*DataHistoryJob, error)

GetJobAndAllResults returns a job and joins all job results

func (*DBService) GetJobsBetween

func (db *DBService) GetJobsBetween(startDate, endDate time.Time) ([]DataHistoryJob, error)

GetJobsBetween will return all jobs between two dates

func (*DBService) Upsert

func (db *DBService) Upsert(jobs ...*DataHistoryJob) error

Upsert inserts or updates jobs into the database

type DataHistoryJob

type DataHistoryJob struct {
	ID               string
	Nickname         string
	ExchangeID       string
	ExchangeName     string
	Asset            string
	Base             string
	Quote            string
	StartDate        time.Time
	EndDate          time.Time
	Interval         int64
	RequestSizeLimit int64
	DataType         int64
	MaxRetryAttempts int64
	BatchSize        int64
	Status           int64
	CreatedDate      time.Time
	Results          []*datahistoryjobresult.DataHistoryJobResult
}

DataHistoryJob is a DTO for database data

type IDBService

type IDBService interface {
	Upsert(jobs ...*DataHistoryJob) error
	GetByNickName(nickname string) (*DataHistoryJob, error)
	GetByID(id string) (*DataHistoryJob, error)
	GetJobsBetween(startDate, endDate time.Time) ([]DataHistoryJob, error)
	GetAllIncompleteJobsAndResults() ([]DataHistoryJob, error)
	GetJobAndAllResults(nickname string) (*DataHistoryJob, error)
}

IDBService allows using data history job database service without needing to care about implementation

Jump to

Keyboard shortcuts

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