mongo

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mongo

type Mongo struct {
	Collection string
	Database   string
	URI        string
}

Mongo represents a simplistic MongoDB configuration

func NewDatastore

func NewDatastore(uri, database, collection string) (*Mongo, error)

NewDatastore creates a new mgo.Session with a strong consistency and a write mode of "majority"

func (*Mongo) AddJob

func (m *Mongo) AddJob(job *models.Job) (*models.Job, error)

AddJob adds an ImportJob document

func (*Mongo) AddUploadedFile

func (m *Mongo) AddUploadedFile(id string, file *models.UploadedFile) error

AddUploadedFile adds an UploadedFile to an import job

func (*Mongo) Close

func (m *Mongo) Close(ctx context.Context) error

Close disconnects the mongo session

func (*Mongo) GetJob

func (m *Mongo) GetJob(id string) (*models.Job, error)

GetJob retrieves a single import job

func (*Mongo) GetJobs

func (m *Mongo) GetJobs(filters []string) ([]models.Job, error)

GetJobs retrieves all import documents matching filters

func (*Mongo) HealthCheckClient

func (m *Mongo) HealthCheckClient() *mongohealth.CheckMongoClient

func (*Mongo) UpdateJob

func (m *Mongo) UpdateJob(id string, job *models.Job) (err error)

UpdateJob adds or overides an existing import job

func (*Mongo) UpdateJobState

func (m *Mongo) UpdateJobState(id, newState string) (err error)

UpdateJobState changes the state attribute of an import job

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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