storage

package module
v0.0.0-...-fc724f3 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: MIT Imports: 8 Imported by: 0

README

Storage

Package for management all alba storage operations.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBClient

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

DBClient represents a mongodb client instance.

func NewDBClient

func NewDBClient(uri string) (*DBClient, error)

NewDBClient returns a DBCLient.

func (*DBClient) Connect

func (c *DBClient) Connect() error

Connect makes the connection and setup of database.

func (*DBClient) Disconnect

func (c *DBClient) Disconnect() error

Disconnect makes the database disconnection.

func (*DBClient) GetExecutions

func (c *DBClient) GetExecutions() ([]Execution, error)

GetExecutions returns all executions in the database.

func (*DBClient) GetExecutionsByID

func (c *DBClient) GetExecutionsByID(id string) ([]Execution, error)

GetExecutionsByID returns all executions of a pipeline.

func (*DBClient) GetPipeline

func (c *DBClient) GetPipeline(id string) (Pipeline, error)

GetPipeline returns a pipeline from database by id.

func (*DBClient) GetPipelines

func (c *DBClient) GetPipelines() ([]Pipeline, error)

GetPipelines returns all pipelines in the database.

func (*DBClient) GetPipelinesByDay

func (c *DBClient) GetPipelinesByDay(day int) ([]Pipeline, error)

GetPipelinesByDay returns all pipelines that have the start-day equal the param.

func (*DBClient) InsertExecution

func (c *DBClient) InsertExecution(e Execution) error

InsertExecution inserts the result of a pipeline execution in the database.

func (*DBClient) InsertPipeline

func (c *DBClient) InsertPipeline(p Pipeline) error

InsertPipeline inserts a pipeline in the database.

type Execution

type Execution struct {
	PipelineResult executor.PipelineResult `bson:"pipeline-result, omitempty" json:"pipeline-result"` // Represents the results for a pipeline execution.
	ID             string                  `bson:"id, omitempty" json:"id"`                           // Initials entity like 'trt13'.
	Entity         string                  `bson:"entity, omitempty" json:"entity"`                   // Entity from which the pipeline extracts data like 'Tribunal Regional do Trabalho 13° Região'.
}

Execution represents the information about a result of a pipeline execution.

type Pipeline

type Pipeline struct {
	Pipeline           executor.Pipeline `bson:"pipeline, omitempty" json:"pipeline"`                         // Represents the sequence of stages for data release.
	ID                 string            `bson:"id, omitempty" json:"id"`                                     // Initials entity like 'trt13'.
	Entity             string            `bson:"entity, omitempty" json:"entity"`                             // Entity from which the pipeline extracts data like 'Tribunal Regional do Trabalho 13° Região'.
	City               string            `bson:"city, omitempty" json:"city"`                                 // City of the entity from which the pipeline extracts data.
	FU                 string            `bson:"fu, omitempty" json:"fu"`                                     // Federation unit of the entity from which the pipeline extracts data.
	Repo               string            `bson:"repo, omitempty" json:"repo"`                                 // Central pipeline repository. Using the import pattern in golang like 'github.com/dadosjusbr/coletores/trt13'.
	Frequency          int               `bson:"frequency, omitempty" json:"frequency"`                       // Frequency of the pipeline execution in days. Values must be between 1 and 30. To be executed monthly it must be filled with '30'.
	StartDay           int               `bson:"start-day, omitempty" json:"start-day"`                       // Day of the month for the pipeline execution. Values must be between 1 and 30.
	LimitMonthBackward int               `bson:"limit-month-backward, omitempty" json:"limit-month-backward"` // The limit month to which the pipeline must be executed in its historical execution.
	LimitYearBackward  int               `bson:"limit-year-backward, omitempty" json:"limit-year-backward"`   // The limit year until which the pipeline must be executed in its historical execution.
	UpdateDate         time.Time         `bson:"update-date, omitempty" json:"update-date"`                   // Last time the pipeline register has been updated.
}

Pipeline represents the information needed for frequent data collection operation.

Jump to

Keyboard shortcuts

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