Documentation
¶
Index ¶
- type Mongo
- func (m *Mongo) CheckAllBundleContentsAreApproved(ctx context.Context, bundleID string) (bool, error)
- func (m *Mongo) CheckBundleExists(ctx context.Context, bundleID string) (bool, error)
- func (m *Mongo) CheckBundleExistsByTitle(ctx context.Context, title string) (bool, error)
- func (m *Mongo) CheckBundleExistsByTitleUpdate(ctx context.Context, title, excludeID string) (bool, error)
- func (m *Mongo) CheckContentItemExistsByDatasetEditionVersion(ctx context.Context, datasetID, editionID string, versionID int) (bool, error)
- func (m *Mongo) Checker(ctx context.Context, state *healthcheck.CheckState) error
- func (m *Mongo) Close(ctx context.Context) error
- func (m *Mongo) CreateBundle(ctx context.Context, bundle *models.Bundle) error
- func (m *Mongo) CreateContentItem(ctx context.Context, contentItem *models.ContentItem) error
- func (m *Mongo) CreateEvent(ctx context.Context, event *models.Event) error
- func (m *Mongo) DeleteBundle(ctx context.Context, id string) (err error)
- func (m *Mongo) DeleteContentItem(ctx context.Context, contentItemID string) error
- func (m *Mongo) GetBundle(ctx context.Context, bundleID string) (*models.Bundle, error)
- func (m *Mongo) GetBundleContentsForBundle(ctx context.Context, bundleID string) (*[]models.ContentItem, error)
- func (m *Mongo) GetBundleEvent(ctx context.Context, bundleID string) (*models.Event, error)
- func (m *Mongo) GetContentItemByBundleIDAndContentItemID(ctx context.Context, bundleID, contentItemID string) (*models.ContentItem, error)
- func (m *Mongo) GetContentItemsByBundleID(ctx context.Context, bundleID string) ([]*models.ContentItem, error)
- func (m *Mongo) Init(ctx context.Context) (err error)
- func (m *Mongo) ListBundleContentIDsWithoutLimit(ctx context.Context, bundleID string) (contents []*models.ContentItem, err error)
- func (m *Mongo) ListBundleContents(ctx context.Context, bundleID string, offset, limit int) (contents []*models.ContentItem, totalCount int, err error)
- func (m *Mongo) ListBundleEvents(ctx context.Context, offset, limit int, bundleID string, ...) (events []*models.Event, totalCount int, err error)
- func (m *Mongo) ListBundles(ctx context.Context, offset, limit int, bundleFilters *filters.BundleFilters) (bundles []*models.Bundle, totalCount int, err error)
- func (m *Mongo) UpdateBundle(ctx context.Context, id string, update *models.Bundle) (*models.Bundle, error)
- func (m *Mongo) UpdateBundleETag(ctx context.Context, bundleID, email string) (*models.Bundle, error)
- func (m *Mongo) UpdateContentItemDatasetInfo(ctx context.Context, contentItemID, title, state string) error
- func (m *Mongo) UpdateContentItemState(ctx context.Context, contentItemID, state string) error
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
CheckBundleExists checks if a bundle exists by ID
func (*Mongo) CheckBundleExistsByTitle ¶ added in v1.4.0
CheckBundleExistsByTitle checks if a bundle exists by its title
func (*Mongo) CheckBundleExistsByTitleUpdate ¶ added in v1.4.0
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) CreateBundle ¶
CreateBundle inserts a new bundle
func (*Mongo) CreateContentItem ¶ added in v1.3.0
CreateContentItem inserts a new content item into the database
func (*Mongo) CreateEvent ¶ added in v1.10.0
CreateEvent inserts a new event into the bundle events collection
func (*Mongo) DeleteBundle ¶
DeleteBundle deletes a bundle by ID
func (*Mongo) DeleteContentItem ¶ added in v1.4.0
DeleteContentItem removes a content item by its 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
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 ¶
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 (*Mongo) ListBundleContents ¶ added in v1.4.0
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 (*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