datahistoryjob

package
v0.8.9 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: MIT Imports: 14 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) GetPrerequisiteJob

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

GetPrerequisiteJob will return the job that must complete before the referenced job

func (*DBService) GetRelatedUpcomingJobs

func (db *DBService) GetRelatedUpcomingJobs(nickname string) ([]*DataHistoryJob, error)

GetRelatedUpcomingJobs will return related jobs

func (*DBService) SetRelationshipByID

func (db *DBService) SetRelationshipByID(prerequisiteJobID, followingJobID string, status int64) error

SetRelationshipByID removes a relationship in the event of a changed relationship during upsertion

func (*DBService) SetRelationshipByNickname

func (db *DBService) SetRelationshipByNickname(prerequisiteNickname, followingNickname string, status int64) error

SetRelationshipByNickname removes a relationship in the event of a changed relationship during upsertion

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
	PrerequisiteJobID           string
	PrerequisiteJobNickname     string
	ConversionInterval          int64
	OverwriteData               bool
	DecimalPlaceComparison      int64
	SecondarySourceExchangeName string
	IssueTolerancePercentage    float64
	ReplaceOnIssue              bool
}

DataHistoryJob is a DTO for database data

type IDBService

type IDBService interface {
	Upsert(...*DataHistoryJob) error
	GetByNickName(string) (*DataHistoryJob, error)
	GetByID(string) (*DataHistoryJob, error)
	GetJobsBetween(time.Time, time.Time) ([]DataHistoryJob, error)
	GetAllIncompleteJobsAndResults() ([]DataHistoryJob, error)
	GetJobAndAllResults(string) (*DataHistoryJob, error)
	GetRelatedUpcomingJobs(string) ([]*DataHistoryJob, error)
	SetRelationshipByID(string, string, int64) error
	SetRelationshipByNickname(string, string, int64) 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