mongodb

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

type Storage struct {
	Client     *mongo.Client
	Database   *mongo.Database
	Collection *mongo.Collection
	Ctx        context.Context
	Cancel     context.CancelFunc
}

func NewStorage

func NewStorage(uri string, database string, collection string, uniqueFields ...string) *Storage

func (*Storage) Close

func (storage *Storage) Close()

func (*Storage) CreateData

func (storage *Storage) CreateData(data any) (bool, string, error)

func (*Storage) DeleteData

func (storage *Storage) DeleteData(id string) (bool, string, error)

func (*Storage) ReadData

func (storage *Storage) ReadData(filter bson.M) ([]bson.M, error)

func (*Storage) UpdateData

func (storage *Storage) UpdateData(id string, data any) (bool, string, error)

Jump to

Keyboard shortcuts

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