mongodb

package
v0.0.0-...-f54e1bb Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: BSD-3-Clause Imports: 7 Imported by: 1

README

mongodb

import "github.com/blueprint-uservices/blueprint/runtime/plugins/mongodb"

Package mongodb implements a cleint interface to a mongodb server that supports MongoDB's query and update API.

Index

type MongoCollection

Implements the [backend.NoSQLCollection] interface as a client-wrapper to a mongodb server

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

func (*MongoCollection) DeleteMany
func (mc *MongoCollection) DeleteMany(ctx context.Context, filter bson.D) error

Implements the [backend.NoSQLCollection] interface

func (*MongoCollection) DeleteOne
func (mc *MongoCollection) DeleteOne(ctx context.Context, filter bson.D) error

Implements the [backend.NoSQLCollection] interface

func (*MongoCollection) FindMany
func (mc *MongoCollection) FindMany(ctx context.Context, filter bson.D, projection ...bson.D) (backend.NoSQLCursor, error)

Implements the [backend.NoSQLCollection] interface

func (*MongoCollection) FindOne
func (mc *MongoCollection) FindOne(ctx context.Context, filter bson.D, projection ...bson.D) (backend.NoSQLCursor, error)

Implements the [backend.NoSQLCollection] interface

func (*MongoCollection) InsertMany
func (mc *MongoCollection) InsertMany(ctx context.Context, documents []interface{}) error

Implements the [backend.NoSQLCollection] interface

func (*MongoCollection) InsertOne
func (mc *MongoCollection) InsertOne(ctx context.Context, document interface{}) error

Implements the [backend.NoSQLCollection] interface

func (*MongoCollection) ReplaceMany
func (mc *MongoCollection) ReplaceMany(ctx context.Context, filter bson.D, replacements ...interface{}) (int, error)

Implements the [backend.NoSQLCollection] interface

func (*MongoCollection) ReplaceOne
func (mc *MongoCollection) ReplaceOne(ctx context.Context, filter bson.D, replacement interface{}) (int, error)

Implements the [backend.NoSQLCollection] interface

func (*MongoCollection) UpdateMany
func (mc *MongoCollection) UpdateMany(ctx context.Context, filter bson.D, update bson.D) (int, error)

Implements the [backend.NoSQLCollection] interface

func (*MongoCollection) UpdateOne
func (mc *MongoCollection) UpdateOne(ctx context.Context, filter bson.D, update bson.D) (int, error)

Implements the [backend.NoSQLCollection] interface

func (*MongoCollection) Upsert
func (mc *MongoCollection) Upsert(ctx context.Context, filter bson.D, document interface{}) (bool, error)

Implements the [backend.NoSQLCollection] interface

func (*MongoCollection) UpsertID
func (mc *MongoCollection) UpsertID(ctx context.Context, id primitive.ObjectID, document interface{}) (bool, error)

Implements the [backend.NoSQLCollection] interface

type MongoCursor

Implements the [backend.NoSQLCursor] interface as a client-wrapper to the Cursor returned by a mongodb server

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

func (*MongoCursor) All
func (mr *MongoCursor) All(ctx context.Context, objs interface{}) error

Implements the [backend.NoSQLCursor] interface

func (*MongoCursor) One
func (mr *MongoCursor) One(ctx context.Context, obj interface{}) (bool, error)

Implements the [backend.NoSQLCursor] interface

type MongoDB

Implements the [backend.NoSQLDatabase] interface as a client-wrapper to a mongodb server.

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

func NewMongoDB
func NewMongoDB(ctx context.Context, addr string) (*MongoDB, error)

Instantiates a new MongoDB client-wrapper instance which connects to a mongodb server running at `addr`. REQUIRED: A mongodb server should be running at `addr`

func (*MongoDB) GetCollection
func (md *MongoDB) GetCollection(ctx context.Context, db_name string, collectionName string) (backend.NoSQLCollection, error)

Implements the [backend.NoSQLDatabase] interface

Generated by gomarkdoc

Documentation

Overview

Package mongodb implements a cleint interface to a mongodb server that supports MongoDB's query and update API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoCollection

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

Implements the backend.NoSQLCollection interface as a client-wrapper to a mongodb server

func (*MongoCollection) DeleteMany

func (mc *MongoCollection) DeleteMany(ctx context.Context, filter bson.D) error

Implements the backend.NoSQLCollection interface

func (*MongoCollection) DeleteOne

func (mc *MongoCollection) DeleteOne(ctx context.Context, filter bson.D) error

Implements the backend.NoSQLCollection interface

func (*MongoCollection) FindMany

func (mc *MongoCollection) FindMany(ctx context.Context, filter bson.D, projection ...bson.D) (backend.NoSQLCursor, error)

Implements the backend.NoSQLCollection interface

func (*MongoCollection) FindOne

func (mc *MongoCollection) FindOne(ctx context.Context, filter bson.D, projection ...bson.D) (backend.NoSQLCursor, error)

Implements the backend.NoSQLCollection interface

func (*MongoCollection) InsertMany

func (mc *MongoCollection) InsertMany(ctx context.Context, documents []interface{}) error

Implements the backend.NoSQLCollection interface

func (*MongoCollection) InsertOne

func (mc *MongoCollection) InsertOne(ctx context.Context, document interface{}) error

Implements the backend.NoSQLCollection interface

func (*MongoCollection) ReplaceMany

func (mc *MongoCollection) ReplaceMany(ctx context.Context, filter bson.D, replacements ...interface{}) (int, error)

Implements the backend.NoSQLCollection interface

func (*MongoCollection) ReplaceOne

func (mc *MongoCollection) ReplaceOne(ctx context.Context, filter bson.D, replacement interface{}) (int, error)

Implements the backend.NoSQLCollection interface

func (*MongoCollection) UpdateMany

func (mc *MongoCollection) UpdateMany(ctx context.Context, filter bson.D, update bson.D) (int, error)

Implements the backend.NoSQLCollection interface

func (*MongoCollection) UpdateOne

func (mc *MongoCollection) UpdateOne(ctx context.Context, filter bson.D, update bson.D) (int, error)

Implements the backend.NoSQLCollection interface

func (*MongoCollection) Upsert

func (mc *MongoCollection) Upsert(ctx context.Context, filter bson.D, document interface{}) (bool, error)

Implements the backend.NoSQLCollection interface

func (*MongoCollection) UpsertID

func (mc *MongoCollection) UpsertID(ctx context.Context, id primitive.ObjectID, document interface{}) (bool, error)

Implements the backend.NoSQLCollection interface

type MongoCursor

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

Implements the backend.NoSQLCursor interface as a client-wrapper to the Cursor returned by a mongodb server

func (*MongoCursor) All

func (mr *MongoCursor) All(ctx context.Context, objs interface{}) error

Implements the backend.NoSQLCursor interface

func (*MongoCursor) One

func (mr *MongoCursor) One(ctx context.Context, obj interface{}) (bool, error)

Implements the backend.NoSQLCursor interface

type MongoDB

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

Implements the backend.NoSQLDatabase interface as a client-wrapper to a mongodb server.

func NewMongoDB

func NewMongoDB(ctx context.Context, addr string) (*MongoDB, error)

Instantiates a new MongoDB client-wrapper instance which connects to a mongodb server running at `addr`. REQUIRED: A mongodb server should be running at `addr`

func (*MongoDB) GetCollection

func (md *MongoDB) GetCollection(ctx context.Context, db_name string, collectionName string) (backend.NoSQLCollection, error)

Implements the backend.NoSQLDatabase interface

Jump to

Keyboard shortcuts

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