infra

package
v0.0.0-...-268a1c9 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobReady     = JobState(iota)
	JobQueued    = JobState(iota)
	JobStarted   = JobState(iota)
	JobSucceeded = JobState(iota)
	JobFailed    = JobState(iota)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	FilePath string
	Database *DbConfig `yaml:"database"`
}

func NewConfig

func NewConfig(filePath string) (*Config, error)

type DbConfig

type DbConfig struct {
	User         string `yaml:"user"`
	Host         string `yaml:"host"`
	Password     string `yaml:"password"`
	Port         int    `yaml:"port"`
	DatabaseName string `yaml:"database_name"`
}

func (*DbConfig) String

func (dc *DbConfig) String() string

type Job

type Job struct {
	Id          int
	Url         string
	ScraperName string
	InsertedAt  *time.Time
	MetaData    string
	State       JobState
	Error       *string
}

type JobCreator

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

func (*JobCreator) AddJob

func (r *JobCreator) AddJob(j *Job) (err error)

func (*JobCreator) Commit

func (r *JobCreator) Commit() error

type JobRepo

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

func NewJobRepo

func NewJobRepo(pgConn *pgxpool.Pool) *JobRepo

func (*JobRepo) AddJob

func (r *JobRepo) AddJob(j *Job) (err error)

func (*JobRepo) GetJob

func (r *JobRepo) GetJob(id int) (job Job, err error)

func (*JobRepo) ListJobs

func (r *JobRepo) ListJobs(state JobState, action func(job *Job)) error

func (*JobRepo) NewJobCreator

func (r *JobRepo) NewJobCreator() (*JobCreator, error)

type JobState

type JobState int

Jump to

Keyboard shortcuts

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