mongoHelper

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalTnxSection bool

Functions

func SetUpMongoConnection

func SetUpMongoConnection()

Types

type Counter

type Counter struct {
	ID        string `json:"_id" bson:"_id"`
	Next      int32  `json:"next" bson:"next"`
	ExpiresAt string `json:"expiresAt" bson:"expiresAt"`
}

type MongoClient

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

func UseMongoDb

func UseMongoDb() *MongoClient

func (*MongoClient) Aggregate

func (m *MongoClient) Aggregate(collectionName string, pipeline mongo.Pipeline, opts options.AggregateOptions) (*mongo.Cursor, error)

func (*MongoClient) Count

func (m *MongoClient) Count(collectionName string, filter interface{}) (int64, error)

func (*MongoClient) FindOneAndUpdate

func (m *MongoClient) FindOneAndUpdate(collectionName string, updateCriteria interface{}, updateData interface{}, opt *options.FindOneAndUpdateOptions) (*mongo.SingleResult, error)

func (*MongoClient) IDGeneratorFromCounterWithPrefix

func (m *MongoClient) IDGeneratorFromCounterWithPrefix(counterId string, prefix string) (string, error)

func (*MongoClient) Insert

func (m *MongoClient) Insert(collectionName string, data interface{}) (string, error)

func (*MongoClient) InsertMany

func (m *MongoClient) InsertMany(collectionName string, data []interface{}) ([]interface{}, error)

func (*MongoClient) Query

func (m *MongoClient) Query(collectionName string, query interface{}, options *options.FindOptions) (*mongo.Cursor, error)

func (*MongoClient) QueryDistinct

func (m *MongoClient) QueryDistinct(collectionName string, query interface{}, fieldName string) (interface{}, error)

func (*MongoClient) QueryOne

func (m *MongoClient) QueryOne(collectionName string, query interface{}, options *options.FindOneOptions) (*mongo.SingleResult, error)

func (*MongoClient) QueryWithSelect

func (m *MongoClient) QueryWithSelect(collectionName string, query interface{}, selectParm interface{}) (*mongo.Cursor, error)

func (*MongoClient) Remove

func (m *MongoClient) Remove(collectionName string, updateCriteria bson.M, opt *options.DeleteOptions) (int64, error)

func (*MongoClient) Update

func (m *MongoClient) Update(collectionName string, updateCriteria bson.M, updateData interface{}, opt *options.UpdateOptions) (int64, error)

func (*MongoClient) UpdateOne

func (m *MongoClient) UpdateOne(collectionName string, updateCriteria bson.M, updateData interface{}) (int64, error)

type MongoMetaData

type MongoMetaData struct {
	Version string `json:"version"`
	Set     string `json:"set"`
}

Jump to

Keyboard shortcuts

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