mongo

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: MIT Imports: 11 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) Checker added in v1.9.0

func (m *Mongo) Checker(ctx context.Context, state *healthcheck.CheckState) error

Checker is called by the healthcheck library to check the health state of this mongoDB instance

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(ctx context.Context, filters []string, offset int, limit int) (*models.JobResults, error)

GetJobs retrieves all import documents matching filters

func (*Mongo) HealthCheckClient

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

HealthCheckClient generates a healthcheck client for this mongoDB, with an existing session

func (*Mongo) UpdateJob

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

UpdateJob adds or overides an existing import job

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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