mongo

package
v0.0.0-...-27d2001 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Aggregate

func Aggregate[T any](ctx context.Context, collection string, pipeline []interface{}) ([]T, error)

func Collection

func Collection(name string) *mongo.Collection

func Connect

func Connect(ctx context.Context, mongoURI, dbName string) error

func DeleteMany

func DeleteMany(ctx context.Context, collection string, filter interface{}) (int64, error)

func DeleteOne

func DeleteOne(ctx context.Context, collection string, filter interface{}) (int64, error)

func Disconnect

func Disconnect() error

func FindById

func FindById[T any](ctx context.Context, collection string, id string) (T, error)

func FindMany

func FindMany[T any](ctx context.Context, collection string, filter interface{}) ([]T, error)

func FindOne

func FindOne[T any](ctx context.Context, collection string, filter interface{}) (T, error)

func InsertMany

func InsertMany(ctx context.Context, collection string, documents []interface{}) ([]string, error)

func InsertOne

func InsertOne(ctx context.Context, collection string, document interface{}) (string, error)

func UpdateMany

func UpdateMany(ctx context.Context, collection string, filter interface{}, update interface{}) (int64, error)

func UpdateOne

func UpdateOne(ctx context.Context, collection string, filter interface{}, update interface{}) (string, error)

Types

type CatalogStoreMongo

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

func NewCatalogStore

func NewCatalogStore() *CatalogStoreMongo

func (*CatalogStoreMongo) CreateCatalog

func (c *CatalogStoreMongo) CreateCatalog(catalog *domain.Catalog) (interface{}, error)

func (*CatalogStoreMongo) CreateControl

func (store *CatalogStoreMongo) CreateControl(catalogId string, control *domain.Control) (interface{}, error)

func (*CatalogStoreMongo) DeleteCatalog

func (store *CatalogStoreMongo) DeleteCatalog(id string) error

func (*CatalogStoreMongo) GetCatalog

func (store *CatalogStoreMongo) GetCatalog(id string) (*domain.Catalog, error)

func (*CatalogStoreMongo) GetControl

func (store *CatalogStoreMongo) GetControl(catalogId string, controlId string) (*domain.Control, error)

func (*CatalogStoreMongo) UpdateCatalog

func (store *CatalogStoreMongo) UpdateCatalog(id string, catalog *domain.Catalog) error

func (*CatalogStoreMongo) UpdateControl

func (store *CatalogStoreMongo) UpdateControl(catalogId string, controlId string, control *domain.Control) (*domain.Catalog, error)

Jump to

Keyboard shortcuts

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