mongo

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: MIT Imports: 13 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 {
	mongodriver.MongoDriverConfig

	Connection *mongodriver.MongoConnection
	// contains filtered or unexported fields
}

func NewDBConnection added in v0.8.0

func NewDBConnection(_ context.Context, cfg config.MongoConfig) (m *Mongo, err error)

NewDBConnection creates a new Mongo object encapsulating a connection to the mongo server/cluster with the given configuration, and a health client to check the health of the mongo server/cluster

func (*Mongo) CheckTopicExists added in v0.4.0

func (m *Mongo) CheckTopicExists(ctx context.Context, 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 It is an error to call m.Close if m.Init() returned an error, and there is no open connection

func (*Mongo) GetContent added in v0.4.0

func (m *Mongo) GetContent(ctx context.Context, 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(ctx context.Context, id string) (*models.TopicResponse, error)

GetTopic retrieves a topic document by its ID

func (*Mongo) UpdateReleaseDate added in v0.13.3

func (m *Mongo) UpdateReleaseDate(ctx context.Context, id string, releaseDate time.Time) error

UpdateReleaseDate update releaseDate of document by its topic ID

func (*Mongo) UpdateState added in v0.15.0

func (m *Mongo) UpdateState(ctx context.Context, id, state string) error

UpdateState updates state field against next object

func (*Mongo) UpdateTopic added in v0.15.0

func (m *Mongo) UpdateTopic(ctx context.Context, host, id string, topic *models.TopicUpdate) error

UpdateTopic updates the next instance with new values.

func (*Mongo) UpsertTopic added in v0.17.0

func (m *Mongo) UpsertTopic(ctx context.Context, id string, topic *models.TopicResponse) error

UpsertTopic creates or overwrites an existing topic (based on id) in mongodb with a new document

Jump to

Keyboard shortcuts

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