datastore

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	mongo.MongoDriverConfig
	MetadataDatabase   string
	MetadataCollection string
}

Config holds the config for the mongodb store

type DefaultDatasetMetadata

type DefaultDatasetMetadata struct {
	// This ID refers to the Population Type
	ID               string `json:"id" bson:"id"`
	DefaultDatasetID string `json:"default_dataset_id" bson:"default_dataset_id"`
	Edition          string `json:"edition" bson:"edition"`
	Version          int    `json:"version" bson:"version"`
}

type MongoClient

type MongoClient struct {
	MetadataCollection string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, cfg Config) (*MongoClient, error)

func (*MongoClient) Checker

func (c *MongoClient) 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 (*MongoClient) Close

func (c *MongoClient) Close(ctx context.Context) error

Close represents mongo session closing within the context deadline

func (*MongoClient) Conn

func (c *MongoClient) Conn() *mongo.MongoConnection

Conn returns the underlying mongodb connection.

func (*MongoClient) GetDefaultDatasetMetadata

func (c *MongoClient) GetDefaultDatasetMetadata(ctx context.Context, populationType string) (*DefaultDatasetMetadata, error)

GetDefaultDatasetMetadata gets the metadata stored against a particular population type

func (*MongoClient) GetDefaultDatasetPopulationTypes

func (c *MongoClient) GetDefaultDatasetPopulationTypes(ctx context.Context) ([]string, error)

GetDefaultDatasetPopulationTypes returns a list of population types for which there is default dataset information

func (*MongoClient) PutDefaultDatasetMetadata

func (c *MongoClient) PutDefaultDatasetMetadata(ctx context.Context, metadata DefaultDatasetMetadata) error

PutDefaultDatasetMetadata puts the metadata stored against a particular population type by upserting the PutDefaultDatasetMetadata struct

Jump to

Keyboard shortcuts

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