datastore

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: MIT Imports: 6 Imported by: 1 module, 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

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