mongo

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2025 License: MIT Imports: 17 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

func SetupIndexes added in v1.3.0

func SetupIndexes(ctx context.Context, mimServer *mim.Server) error

Types

type Mongo

type Mongo struct {
	config.MongoConfig

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

func (*Mongo) CheckAllBundleContentsAreApproved added in v1.2.0

func (m *Mongo) CheckAllBundleContentsAreApproved(ctx context.Context, bundleID string) (bool, error)

CheckAllBundleContentsAreApproved checks if all contents of a bundle are in the approved state

func (*Mongo) CheckBundleExists added in v1.3.0

func (m *Mongo) CheckBundleExists(ctx context.Context, bundleID string) (bool, error)

CheckBundleExists checks if a bundle exists by ID

func (*Mongo) CheckContentItemExistsByDatasetEditionVersion added in v1.3.0

func (m *Mongo) CheckContentItemExistsByDatasetEditionVersion(ctx context.Context, datasetID, editionID string, versionID int) (bool, error)

CheckContentItemExistsByDatasetEditionVersion checks if a content item exists with the specified dataset, edition, and version

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 represents mongo session closing within the context deadline

func (*Mongo) CreateBundle

func (m *Mongo) CreateBundle(ctx context.Context, bundle *models.Bundle) error

CreateBundle inserts a new bundle

func (*Mongo) CreateBundleEvent added in v1.2.0

func (m *Mongo) CreateBundleEvent(ctx context.Context, event *models.Event) error

CreateBundleEvent inserts a new bundle event

func (*Mongo) CreateContentItem added in v1.3.0

func (m *Mongo) CreateContentItem(ctx context.Context, contentItem *models.ContentItem) error

CreateContentItem inserts a new content item into the database

func (*Mongo) DeleteBundle

func (m *Mongo) DeleteBundle(ctx context.Context, id string) (err error)

DeleteBundle deletes a bundle by ID

func (*Mongo) GetBundle

func (m *Mongo) GetBundle(ctx context.Context, bundleID string) (*models.Bundle, error)

GetBundle retrieves a single bundle by ID

func (*Mongo) GetBundleEvent added in v1.3.0

func (m *Mongo) GetBundleEvent(ctx context.Context, bundleID string) (*models.Event, error)

GetBundleEvent retrieves an event by Bundle ID

func (*Mongo) Init

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

Init returns an initialised Mongo object encapsulating a connection to the mongo server/cluster with the given configuration, a health client to check the health of the mongo server/cluster, and a lock client

func (*Mongo) ListBundleEvents added in v1.3.0

func (m *Mongo) ListBundleEvents(ctx context.Context, offset, limit int, bundleID string, after, before *time.Time) (events []*models.Event, totalCount int, err error)

ListBundleEvents retrieves all bundle events with optional filtering and pagination

func (*Mongo) ListBundles

func (m *Mongo) ListBundles(ctx context.Context, offset, limit int, filters *filters.BundleFilters) (bundles []*models.Bundle, totalCount int, err error)

ListBundles retrieves all bundles based on the provided offset, limit, and BundleFilters

func (*Mongo) UpdateBundle

func (m *Mongo) UpdateBundle(ctx context.Context, id string, update *models.Bundle) (*models.Bundle, error)

func (*Mongo) UpdateBundleETag added in v1.3.0

func (m *Mongo) UpdateBundleETag(ctx context.Context, bundleID, email string) (*models.Bundle, error)

UpdateBundleETag updates the ETag, last_updated_by, and updated_at fields of a bundle

Jump to

Keyboard shortcuts

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