db

package
v0.0.0-...-0b9253c Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CronJob

type CronJob struct {
	ID       string
	IsActive bool
	Function string
	Workload string
	CronTime string
	TimeZone string
	Backend  string
	Created  time.Time
}

CronJob is the normalized format interfacing with API handlers

type DB

type DB interface {
	GetDistinctActiveFunctions() ([]string, error)
	GetJobs(function string) ([]CronJob, error)
	UpdateJob(cronJob CronJob) error
	AddJob(job CronJob) error
	DeleteJob(jobID string) error
}

DB is required type when registering API handlers

type MongoDB

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

MongoDB is the visible DB interface used in server

func NewMongoDB

func NewMongoDB(session *mgo.Session) *MongoDB

NewMongoDB attempts to connect with DB and errs if problems are found

func (*MongoDB) AddJob

func (db *MongoDB) AddJob(job CronJob) error

AddJob parses CronJob input and inserts into DB

func (*MongoDB) DeleteJob

func (db *MongoDB) DeleteJob(jobID string) error

DeleteJob removes jobID from DB

func (*MongoDB) GetDistinctActiveFunctions

func (db *MongoDB) GetDistinctActiveFunctions() ([]string, error)

GetDistinctActiveFunctions returns a list of functions with active jobs

func (*MongoDB) GetJobs

func (db *MongoDB) GetJobs(function string) ([]CronJob, error)

GetJobs returns all jobs associated with a function

func (*MongoDB) UpdateJob

func (db *MongoDB) UpdateJob(cronJob CronJob) error

UpdateJob updates existing document as determined by CronJob input

Jump to

Keyboard shortcuts

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