repo

package
v0.0.0-...-a67b36e Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repo

type Repo interface {
	// InsertOne appends the database with the given data
	InsertOne(ctx context.Context, db, collection string, query interface{}) error
	// UpdateOne updates on document in the database with the given data and based on the given filter
	// returns the number of updated documents and an error. Accepts mongo.UpdateOption.Upsert to upsert documents
	UpdateOne(ctx context.Context, db, collection string, filter, query interface{}, upsert bool) (int, error)
	// FindOne selects zero or one match from the filter an assigns the data in the given pointer to results
	FindOne(ctx context.Context, db, collection string, filter, result interface{}) error
	// FindMany select zero or many matches from the filter an assigns the data in the given pointer to results
	FindMany(ctx context.Context, db, collection string, filter, results interface{}) error
	// Exists checks whether something exists in the storage based on the filter
	Exists(ctx context.Context, db, collection string, filter interface{}) (bool, error)
	// Delete deletes a document based on a given filter
	DeleteOne(ctx context.Context, db, collection string, filter interface{}) error
}

func NewMongoDB

func NewMongoDB(addr string) (Repo, error)

Jump to

Keyboard shortcuts

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