db

package
v0.0.0-...-004ddcb Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArangoClient

type ArangoClient struct {
	// contains filtered or unexported fields
}

TODO: This Client is shared between the Populator and Populator-API. Meanwhile both the Subscriber and Calculator ALSO have their own respective Arango clients. Need to look at how this sprawl can be refactored to reduce duplication and maintenance overhead.

func NewArangoClient

func NewArangoClient(
	configs []config.DatabaseInfo,
	logger interfaces.Logger,
) (*ArangoClient, error)

func (*ArangoClient) FetchHosts

func (c *ArangoClient) FetchHosts(ctx context.Context) ([]string, error)

func (*ArangoClient) QueryAnnotations

func (c *ArangoClient) QueryAnnotations(
	ctx context.Context,
	key string,
) ([]documents.Annotation, error)

func (*ArangoClient) QueryScore

func (c *ArangoClient) QueryScore(ctx context.Context, key string) (documents.Score, error)

func (*ArangoClient) QueryScoreByLayer

func (c *ArangoClient) QueryScoreByLayer(
	ctx context.Context,
	key string,
	layer contracts.LayerType,
) ([]documents.Score, error)

type MongoProvider

type MongoProvider struct {
	// contains filtered or unexported fields
}

func NewMongoProvider

func NewMongoProvider(configs []config.DatabaseInfo, logger interfaces.Logger) (*MongoProvider, error)

func (*MongoProvider) Close

func (mp *MongoProvider) Close(ctx context.Context) error

func (*MongoProvider) CountDocuments

func (mp *MongoProvider) CountDocuments(ctx context.Context) (int, error)

func (*MongoProvider) FetchById

func (mp *MongoProvider) FetchById(ctx context.Context, id string) (models.MongoRecord, error)

func (*MongoProvider) QueryMostRecent

func (mp *MongoProvider) QueryMostRecent(ctx context.Context, count int) ([]models.MongoRecord, error)

func (*MongoProvider) QueryUnpopulated

func (mp *MongoProvider) QueryUnpopulated(ctx context.Context) ([]models.MongoRecord, error)

func (*MongoProvider) QueryUnpopulatedBson

func (mp *MongoProvider) QueryUnpopulatedBson(ctx context.Context) ([]bson.M, error)

QueryUnpopulatedBson is available for testing should you want to output the raw BSON returned by Mongo for debugging map operations to JSON.

func (*MongoProvider) UpdateDocument

func (mp *MongoProvider) UpdateDocument(ctx context.Context, mr models.MongoRecord) error

Jump to

Keyboard shortcuts

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