mongo

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mongo

type Mongo struct {
	Session           *mgo.Session
	URI               string
	Database          string
	TopicsCollection  string
	ContentCollection string
	// contains filtered or unexported fields
}

Mongo represents a simplistic MongoDB config, with session, health and lock clients

func (*Mongo) CheckTopicExists added in v0.4.0

func (m *Mongo) CheckTopicExists(id string) error

CheckTopicExists checks that the topic exists

func (*Mongo) Checker

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 closes the mongo session and returns any error

func (*Mongo) GetContent added in v0.4.0

func (m *Mongo) GetContent(id string, queryTypeFlags int) (*models.ContentResponse, error)

GetContent retrieves a content document by its ID

func (*Mongo) GetTopic added in v0.3.0

func (m *Mongo) GetTopic(id string) (*models.TopicResponse, error)

GetTopic retrieves a topic document by its ID

func (*Mongo) Init

func (m *Mongo) Init(ctx context.Context) (err error)

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

Jump to

Keyboard shortcuts

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