database

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: GPL-3.0, GPL-3.0-or-later Imports: 11 Imported by: 0

Documentation

Overview

Package database contains methods used to perform CRUD operations to the MongoDB database

Package database contains methods used to perform CRUD operations to the MongoDB database

Package database contains methods used to perform CRUD operations to the MongoDB database

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterByLocationAndEnvironmentSteps

func FilterByLocationAndEnvironmentSteps(location string, environment string) interface{}

FilterByLocationAndEnvironmentSteps return the steps required to filter the data by the location and environment field.

func FilterByOldnessSteps

func FilterByOldnessSteps(olderThan time.Time) bson.A

Types

type MongoDatabase

type MongoDatabase struct {
	// Config contains the dataservice global configuration
	Config config.Configuration
	// Client contain the mongodb client
	Client *mongo.Client
	// TimeNow contains a function that return the current time
	TimeNow func() time.Time
	// Log contains logger formatted
	Log *logrus.Logger
	// OperatingSystemAggregationRules contains rules used to aggregate various operating systems
	OperatingSystemAggregationRules []config.AggregationRule
}

MongoDatabase is a implementation

func (*MongoDatabase) ConnectToMongodb

func (md *MongoDatabase) ConnectToMongodb()

ConnectToMongodb connects to the MongoDB and return the connection

func (*MongoDatabase) GetOracleDatabaseChartByVersion

func (md *MongoDatabase) GetOracleDatabaseChartByVersion(location string, environment string, olderThan time.Time) ([]dto.ChartBubble, utils.AdvancedErrorInterface)

GetOracleDatabaseChartByVersion return the chart data about oracle database version

func (*MongoDatabase) GetOracleDatabaseChartByWork

func (md *MongoDatabase) GetOracleDatabaseChartByWork(location string, environment string, olderThan time.Time) ([]dto.ChartBubble, utils.AdvancedErrorInterface)

GetOracleDatabaseChartByWork return the chart data about the work of all database

func (*MongoDatabase) GetOracleDbLicenseHistory

func (md *MongoDatabase) GetOracleDbLicenseHistory() ([]dto.OracleDatabaseLicenseHistory, error)

func (*MongoDatabase) GetTechnologyCount

func (md *MongoDatabase) GetTechnologyCount(location string, environment string, olderThan time.Time) (map[string]float64, utils.AdvancedErrorInterface)

GetTechnologyCount return the number of occurence per technology

func (*MongoDatabase) Init

func (md *MongoDatabase) Init()

Init initializes the connection to the database

type MongoDatabaseInterface

type MongoDatabaseInterface interface {
	// Init initializes the connection to the database
	Init()

	// GetTechnologyCount return the number of occurence per technology
	GetTechnologyCount(location string, environment string, olderThan time.Time) (map[string]float64, utils.AdvancedErrorInterface)

	// GetOracleDatabaseChartByVersion return the chart data about oracle database version
	GetOracleDatabaseChartByVersion(location string, environment string, olderThan time.Time) ([]dto.ChartBubble, utils.AdvancedErrorInterface)
	// GetOracleDatabaseChartByWork return the chart data about the work of all database
	GetOracleDatabaseChartByWork(location string, environment string, olderThan time.Time) ([]dto.ChartBubble, utils.AdvancedErrorInterface)
	GetOracleDbLicenseHistory() ([]dto.OracleDatabaseLicenseHistory, error)
}

MongoDatabaseInterface is a interface that wrap methods used to perform CRUD operations in the mongodb database

Jump to

Keyboard shortcuts

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