mongodb

package
v0.0.0-...-7538a8c Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateUri

func GenerateUri(host, port, name, username, password string) string

Types

type Aggregate

type Aggregate struct {
	Result interface{}
	Filter interface{}
}

type Collections

type Collections interface {
	Find(payload Find, ctx context.Context) error
	FindAll(payload FindAll, ctx context.Context) error // without page and size
	Count(payload CountData, ctx context.Context) error
	FindOne(payload FindOne, ctx context.Context) error
	InsertOne(payload InsertOne, ctx context.Context) error
	UpdateOne(payload UpdateOne, ctx context.Context) error
	Aggregate(payload Aggregate, ctx context.Context) error
	DeleteOne(payload DeleteOne, ctx context.Context) error
}

Collections is mongodb's collection of function

func NewMongoDBLogger

func NewMongoDBLogger(mongoClient Mongodb, collectionName string) Collections

type CountData

type CountData struct {
	Result *int64
	Filter interface{}
}

type DeleteOne

type DeleteOne struct {
	Filter interface{}
}

type Find

type Find struct {
	Result    interface{}
	CountData *int64
	Filter    interface{}
	Sort      []models.Sort
	Page      int64
	Size      int64
}

type FindAll

type FindAll struct {
	Result    interface{}
	CountData *int64
	Filter    interface{}
	Sort      []models.Sort
}

type FindOne

type FindOne struct {
	Result interface{}
	Filter interface{}
}

type InsertOne

type InsertOne struct {
	Result   *string
	Document interface{}
}

type MongoDBLogger

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

func (MongoDBLogger) Aggregate

func (m MongoDBLogger) Aggregate(payload Aggregate, ctx context.Context) error

func (MongoDBLogger) Count

func (m MongoDBLogger) Count(payload CountData, ctx context.Context) error

func (MongoDBLogger) DeleteOne

func (m MongoDBLogger) DeleteOne(payload DeleteOne, ctx context.Context) error

func (MongoDBLogger) Find

func (m MongoDBLogger) Find(payload Find, ctx context.Context) error

func (MongoDBLogger) FindAll

func (m MongoDBLogger) FindAll(payload FindAll, ctx context.Context) error

func (MongoDBLogger) FindOne

func (m MongoDBLogger) FindOne(payload FindOne, ctx context.Context) error

func (MongoDBLogger) InsertOne

func (m MongoDBLogger) InsertOne(payload InsertOne, ctx context.Context) error

func (MongoDBLogger) UpdateOne

func (m MongoDBLogger) UpdateOne(payload UpdateOne, ctx context.Context) error

type Mongodb

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

func InitConnection

func InitConnection(masterDBUrl string, logger logger.Logger) Mongodb

func (Mongodb) GetMongoClient

func (r Mongodb) GetMongoClient() *mongo.Client

func (Mongodb) GetMongoLogger

func (r Mongodb) GetMongoLogger() logger.Logger

type Templates

type Templates interface {
	Save(obj interface{}, ctx context.Context) error
	Update(obj interface{}, ctx context.Context) error
	FindById(id string, result interface{}, ctx context.Context) error
}

func ImplementTemplateRepository

func ImplementTemplateRepository(mongoDb Collections) Templates

type UpdateOne

type UpdateOne struct {
	Filter   interface{}
	Document interface{}
}

Jump to

Keyboard shortcuts

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