mongo

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 18 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 {
	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) CheckBundleExistsByTitle added in v1.4.0

func (m *Mongo) CheckBundleExistsByTitle(ctx context.Context, title string) (bool, error)

CheckBundleExistsByTitle checks if a bundle exists by its title

func (*Mongo) CheckBundleExistsByTitleUpdate added in v1.4.0

func (m *Mongo) CheckBundleExistsByTitleUpdate(ctx context.Context, title, excludeID string) (bool, error)

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) 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) CreateEvent added in v1.10.0

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

CreateEvent inserts a new event into the bundle events collection

func (*Mongo) DeleteBundle

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

DeleteBundle deletes a bundle by ID

func (*Mongo) DeleteContentItem added in v1.4.0

func (m *Mongo) DeleteContentItem(ctx context.Context, contentItemID string) error

DeleteContentItem removes a content item by its 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) GetBundleContentsForBundle added in v1.4.0

func (m *Mongo) GetBundleContentsForBundle(ctx context.Context, bundleID string) (*[]models.ContentItem, error)

GetBundleContentsForBundle retrieves all ContentItems for the specified bundle

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) GetContentItemByBundleIDAndContentItemID added in v1.4.0

func (m *Mongo) GetContentItemByBundleIDAndContentItemID(ctx context.Context, bundleID, contentItemID string) (*models.ContentItem, error)

GetContentItemByBundleIDAndContentItemID retrieves a content item by bundle ID and content item ID

func (*Mongo) GetContentItemsByBundleID added in v1.4.0

func (m *Mongo) GetContentItemsByBundleID(ctx context.Context, bundleID string) ([]*models.ContentItem, error)

GetContentItemsByBundleID retrieves all content items for a specific bundle

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) ListBundleContentIDsWithoutLimit added in v1.4.0

func (m *Mongo) ListBundleContentIDsWithoutLimit(ctx context.Context, bundleID string) (contents []*models.ContentItem, err error)

func (*Mongo) ListBundleContents added in v1.4.0

func (m *Mongo) ListBundleContents(ctx context.Context, bundleID string, offset, limit int) (contents []*models.ContentItem, totalCount int, err error)

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, bundleFilters *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

func (*Mongo) UpdateContentItemDatasetInfo added in v1.4.0

func (m *Mongo) UpdateContentItemDatasetInfo(ctx context.Context, contentItemID, title, state string) error

UpdateContentItemDatasetInfo updates a content item with dataset title and state

func (*Mongo) UpdateContentItemState added in v1.4.0

func (m *Mongo) UpdateContentItemState(ctx context.Context, contentItemID, state string) error

UpdateContentItemState updates the state for the content item matching the contentItemID

Jump to

Keyboard shortcuts

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