store

package
v0.0.0-...-0efd02e Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStatusHandler

func NewStatusHandler(e *echo.Echo, db *mongo.Database)

NewStatusHandler will initialize the /status endpoint

func Open

func Open(ctx context.Context, cfg MongoConfig, logger *zap.Logger) (*mongo.Client, error)

Open creates MongoDB client

func Seed

func Seed(ctx context.Context, db *mongo.Database) error

Seed inserts data in database for development purposes

func StatusCheck

func StatusCheck(ctx context.Context, db *mongo.Database) (*bson.M, error)

StatusCheck gets database status and metrics

func StructToDoc

func StructToDoc(v interface{}) (doc *bson.D, err error)

StructToDoc transforms any struct to bson.D document

Types

type MongoConfig

type MongoConfig struct {
	Name     string `yaml:"name"`
	User     string `yaml:"user"`
	Password string `yaml:"pwd"`
	HostPort string `yaml:"host_port"`
}

MongoConfig stores MongoDB configuration

type StatusHandler

type StatusHandler struct {
	DB *mongo.Database
}

StatusHandler represent the http handler for status check

func (*StatusHandler) StatusCheckHandler

func (h *StatusHandler) StatusCheckHandler(c echo.Context) error

StatusCheckHandler will get status of the database

Jump to

Keyboard shortcuts

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