mongodb

package
v0.0.0-...-a199e7b Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IMongoRepository

type IMongoRepository[I any, O any] interface {
	InsertOne(schema *I, ctx context.Context) (*O, error)
	FindAll(schema *[]I, ctx context.Context) (*[]O, error)
	UpdateOne(schema *I, filter interface{}, ctx context.Context) (*O, error)
}

func NewMongoRepository

func NewMongoRepository[I any, O any](client *mongo.Client, dbName, collectionName string) IMongoRepository[I, O]

type MongoDBConfig

type MongoDBConfig struct {
	URI    string
	Logger interface{}
}

func NewMongoConnection

func NewMongoConnection(cfg *MongoDBConfig) *MongoDBConfig

func (*MongoDBConfig) GetMongoClient

func (m *MongoDBConfig) GetMongoClient() *mongo.Client

type MongoRepository

type MongoRepository[I any, O any] struct {
	// contains filtered or unexported fields
}

func (*MongoRepository[I, O]) FindAll

func (r *MongoRepository[I, O]) FindAll(schema *[]I, ctx context.Context) (*[]O, error)

func (*MongoRepository[I, O]) InsertOne

func (r *MongoRepository[I, O]) InsertOne(schema *I, ctx context.Context) (*O, error)

func (*MongoRepository[I, O]) UpdateOne

func (r *MongoRepository[I, O]) UpdateOne(schema *I, filter interface{}, ctx context.Context) (*O, error)

Jump to

Keyboard shortcuts

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