db

package
v0.0.0-...-c5cc430 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetConfigMongo

func SetConfigMongo(host string, port int, dbname string)

func SetConfigPG

func SetConfigPG(host string, port int, user string, password string, dbname string)

func SetupMongo

func SetupMongo(host string, port int, dbname string)

func SetupPG

func SetupPG(host string, port int, user string, password string, dbname string)

Types

type Metric

type Metric struct {
	Date   time.Time              `json:"date"`
	Metric string                 `json:"metric"`
	Source string                 `json:"source"`
	Tags   map[string]interface{} `json:"tags"`
	Value  float64                `json:"value"`
}

func MongoQuery

func MongoQuery(metric string, begin time.Time, end time.Time) ([]Metric, error)

func MongoQuerySource

func MongoQuerySource(metric string, begin time.Time, end time.Time, source string) ([]Metric, error)

func PgQuery

func PgQuery(metric string, begin time.Time, end time.Time) ([]Metric, error)

func PgQuerySource

func PgQuerySource(metric string, begin time.Time, end time.Time, source string) ([]Metric, error)

func Query

func Query(metric string, begin time.Time, end time.Time) ([]Metric, error)

func QuerySource

func QuerySource(metric string, begin time.Time, end time.Time, source string) ([]Metric, error)

type MongoMetric

type MongoMetric struct {
	ID     primitive.ObjectID     `bson:"_id,omitempty"`
	Date   time.Time              `bson:"date,omitempty"`
	Metric string                 `bson:"metric,omitempty"`
	Source string                 `bson:"source,omitempty"`
	Tags   map[string]interface{} `bson:"tags,omitempty"`
	Value  float64                `bson:"value,omitempty"`
}

Jump to

Keyboard shortcuts

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