mongo

package
v0.0.0-...-205e723 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DATABASE   = "db"
	COLLECTION = "shop"
)

Variables

This section is empty.

Functions

func Close

func Close(client *mongo.Client, ctx context.Context,
	cancel context.CancelFunc)

This is a user defined method to close resources. This method closes mongoDB connection and cancel context.

func HealthCheck

func HealthCheck(client *mongo.Client, ctx context.Context)

func Ping

func Ping(client *mongo.Client, ctx context.Context) bool

This is a user defined method that accepts mongo.Client and context.Context This method used to ping the mongoDB, return error if any.

func Query

func Query(client *mongo.Client, ctx context.Context,
	dataBase, col string, query, field interface{}) (result *mongo.Cursor, err error)

Types

type ShopRepository

type ShopRepository interface {
	Save(shop *model.Shop)
	FindAll() []*model.Shop
}

func NewShopRepository

func NewShopRepository() ShopRepository

Jump to

Keyboard shortcuts

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