mongo

package
v0.0.0-...-c35b06e Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MngoCtx context.Context

	ResourceMap map[string]interface{}
)
View Source
var CollectionMap map[string]*mongo.Collection

Will store the created collection object for a faster access

View Source
var IndexesMap map[string][]mongo.IndexModel
View Source
var MONGOService = MongoDB{}

Functions

func GetObjIDFromString

func GetObjIDFromString(id string) interface{}

Types

type MongoConf

type MongoConf interface {
	GetUrl() string
	GetDatabase() string
}

type MongoDB

type MongoDB struct {
	Logger zerolog.Logger
}

func (*MongoDB) DeleteMultiple

func (m *MongoDB) DeleteMultiple(f map[string]interface{}, collection_name string) (int64, int, error)

func (*MongoDB) DeleteOne

func (m *MongoDB) DeleteOne(id string, collection_name string) (int64, int, error)

func (*MongoDB) Init

func (m *MongoDB) Init(collections []string, config MongoConf)

func (*MongoDB) LoadAll

func (m *MongoDB) LoadAll(collection_name string) (*mongo.Cursor, int, error)

func (*MongoDB) LoadFilter

func (m *MongoDB) LoadFilter(filter map[string]interface{}, collection_name string) (*mongo.Cursor, int, error)

func (*MongoDB) LoadOne

func (m *MongoDB) LoadOne(id string, collection_name string) (*mongo.SingleResult, int, error)

func (*MongoDB) Search

func (m *MongoDB) Search(filters *dbs.Filters, collection_name string) (*mongo.Cursor, int, error)

func (*MongoDB) StoreOne

func (m *MongoDB) StoreOne(obj interface{}, id string, collection_name string) (string, int, error)

func (*MongoDB) TestCollections

func (m *MongoDB) TestCollections(config MongoConf, neededCols []string) error

func (*MongoDB) TestDB

func (m *MongoDB) TestDB(config MongoConf) error

func (*MongoDB) UpdateMultiple

func (m *MongoDB) UpdateMultiple(set interface{}, filter map[string]interface{}, collection_name string) (int64, int, error)

func (*MongoDB) UpdateOne

func (m *MongoDB) UpdateOne(set interface{}, id string, collection_name string) (string, int, error)

Jump to

Keyboard shortcuts

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