mongodb

package
v0.0.0-...-cee4bc5 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureIndexes

func EnsureIndexes(ctx context.Context, c *mongo.Collection) error

Types

type Bootstraper

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

func NewBootstraper

func NewBootstraper(c Collection) *Bootstraper

func (*Bootstraper) LoadTrackers

func (b *Bootstraper) LoadTrackers(ctx context.Context, g generator.Processes) error

func (*Bootstraper) UnloadTrackers

func (b *Bootstraper) UnloadTrackers(ctx context.Context, g generator.Processes) error

type Collection

type Collection interface {
	Find(ctx context.Context, filter interface{},
		opts ...*options.FindOptions) (cur *mongo.Cursor, err error)

	FindOne(ctx context.Context, filter interface{},
		opts ...*options.FindOneOptions) *mongo.SingleResult

	InsertOne(ctx context.Context, document interface{},
		opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)

	DeleteOne(ctx context.Context, filter interface{},
		opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)

	UpdateOne(ctx context.Context, filter interface{}, update interface{},
		opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)

	BulkWrite(ctx context.Context, models []mongo.WriteModel,
		opts ...*options.BulkWriteOptions) (*mongo.BulkWriteResult, error)

	Aggregate(ctx context.Context, pipeline interface{},
		opts ...*options.AggregateOptions) (*mongo.Cursor, error)
}

type Query

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

func NewQuery

func NewQuery(c Collection) *Query

func (*Query) SearchTrackers

func (q *Query) SearchTrackers(ctx context.Context, f generator.Filter) (generator.SearchResult, error)

func (*Query) Stats

func (q *Query) Stats(ctx context.Context) ([]generator.StatsItem, error)

type Storage

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

func New

func New(c Collection) *Storage

func (*Storage) Delete

func (s *Storage) Delete(ctx context.Context, trackerID types.ID) error

func (*Storage) Find

func (s *Storage) Find(ctx context.Context, trackerID types.ID) (*generator.Tracker, error)

func (*Storage) Insert

func (s *Storage) Insert(ctx context.Context, t *generator.Tracker) error

func (*Storage) Update

func (s *Storage) Update(ctx context.Context, t *generator.Tracker) error

Jump to

Keyboard shortcuts

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