simplenosqldb

package
v0.0.0-...-9a5c20e Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: BSD-3-Clause Imports: 8 Imported by: 1

README

simplenosqldb

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

Package simplenosqldb implements an in-memory NoSQLDB that supports a subset of MongoDB's query and update API.

Only a small set of common basic filter and update operators are supported, but typically this is sufficient for most applications and enables writing service-level unit tests.

Index

func SetVerbose

func SetVerbose(enabled bool) bool

Enable or disable verbose logging; used for testing

type SimpleCollection

Simple implementations of the NoSQLDB Interfaces from runtime/core/backend

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

func (*SimpleCollection) DeleteMany
func (db *SimpleCollection) DeleteMany(ctx context.Context, filter bson.D) error

func (*SimpleCollection) DeleteOne
func (db *SimpleCollection) DeleteOne(ctx context.Context, filter bson.D) error

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

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

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

func (*SimpleCollection) InsertOne
func (db *SimpleCollection) InsertOne(ctx context.Context, document interface{}) error

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

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

func (*SimpleCollection) String
func (db *SimpleCollection) String() string

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

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

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

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

type SimpleCursor

Simple implementations of the NoSQLDB Interfaces from runtime/core/backend

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

func (*SimpleCursor) All
func (c *SimpleCursor) All(ctx context.Context, obj interface{}) error

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

type SimpleNoSQLDB

Implements the [backend.NoSQLDatabase] interface for a subset of MongoDB's query and update operators.

Only a small set of common basic filter and update operators are supported, but typically this is sufficient for most applications and enables writing service-level unit tests.

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

func NewSimpleNoSQLDB
func NewSimpleNoSQLDB(ctx context.Context) (*SimpleNoSQLDB, error)

Instantiate a new in-memory NoSQLDB

func (*SimpleNoSQLDB) GetCollection
func (impl *SimpleNoSQLDB) GetCollection(ctx context.Context, db_name string, collection_name string) (backend.NoSQLCollection, error)

Generated by gomarkdoc

Documentation

Overview

Package simplenosqldb implements an in-memory NoSQLDB that supports a subset of MongoDB's query and update API.

Only a small set of common basic filter and update operators are supported, but typically this is sufficient for most applications and enables writing service-level unit tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetVerbose

func SetVerbose(enabled bool) bool

Enable or disable verbose logging; used for testing

Types

type SimpleCollection

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

Simple implementations of the NoSQLDB Interfaces from runtime/core/backend

func (*SimpleCollection) DeleteMany

func (db *SimpleCollection) DeleteMany(ctx context.Context, filter bson.D) error

func (*SimpleCollection) DeleteOne

func (db *SimpleCollection) DeleteOne(ctx context.Context, filter bson.D) error

func (*SimpleCollection) FindMany

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

func (*SimpleCollection) FindOne

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

func (*SimpleCollection) InsertMany

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

func (*SimpleCollection) InsertOne

func (db *SimpleCollection) InsertOne(ctx context.Context, document interface{}) error

func (*SimpleCollection) ReplaceMany

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

func (*SimpleCollection) ReplaceOne

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

func (*SimpleCollection) String

func (db *SimpleCollection) String() string

func (*SimpleCollection) UpdateMany

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

func (*SimpleCollection) UpdateOne

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

func (*SimpleCollection) Upsert

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

func (*SimpleCollection) UpsertID

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

type SimpleCursor

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

Simple implementations of the NoSQLDB Interfaces from runtime/core/backend

func (*SimpleCursor) All

func (c *SimpleCursor) All(ctx context.Context, obj interface{}) error

func (*SimpleCursor) One

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

type SimpleNoSQLDB

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

Implements the backend.NoSQLDatabase interface for a subset of MongoDB's query and update operators.

Only a small set of common basic filter and update operators are supported, but typically this is sufficient for most applications and enables writing service-level unit tests.

func NewSimpleNoSQLDB

func NewSimpleNoSQLDB(ctx context.Context) (*SimpleNoSQLDB, error)

Instantiate a new in-memory NoSQLDB

func (*SimpleNoSQLDB) GetCollection

func (impl *SimpleNoSQLDB) GetCollection(ctx context.Context, db_name string, collection_name string) (backend.NoSQLCollection, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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