mongodb

package
v0.0.0-...-2f0a4f1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2023 License: AGPL-3.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 Client

type Client interface {
	Database(string) Database
	Disconnect(ctx context.Context) error
}

func NewClient

func NewClient(uri string, connectTimout time.Duration) (Client, error)

type Collection

type Collection interface {
	Find(ctx context.Context, filter interface{}) (Cursor, error)
	InsertOne(ctx context.Context, document interface{}) (*mongo.InsertOneResult, error)
	UpdateOrAddOne(ctx context.Context, filter, update interface{}) (*mongo.UpdateResult, error)
	DeleteOne(ctx context.Context, filter interface{}) (*mongo.DeleteResult, error)
}

type Cursor

type Cursor interface {
	Close(ctx context.Context) error
	All(ctx context.Context, results interface{}) error
}

type Database

type Database interface {
	Collection(name string) Collection
}

type MongoDB

type MongoDB interface {
	Put(ctx context.Context, database, collection string, filter, update interface{}) error
	GetAll(ctx context.Context, database, collection string, data interface{}) error
	Delete(ctx context.Context, database, collection string, filter interface{}) error
	Close(ctx context.Context) error
}

func NewMongoDB

func NewMongoDB(client Client, operationTimeout time.Duration) MongoDB

NewMongoDB creates a new MongoDB.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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