Help us shape the future of Go! Take the 2026 Go Developer Survey

server

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvPrefix           = "proxy"
	MongoAddressKey     = "mongo.address"
	MongoAddressDefault = "localhost:27017"
)

Default value

View Source
const (
	ProductURL         = "products/products"
	AertlistURL        = "alert/alertlist"
	AlarmlistURL       = "alert/alarmlist"
	DeviceURL          = "devices/"
	LogrdbURL          = "logrdb/"
	UsersURL           = "users/users"
	CubeURL            = "cube/cube_message"
	CubeVoltageURL     = "cube/cube_message/voltage"
	CubeTemperatureURL = "cube/cube_message/temperature"
	CubeCurrentURL     = "cube/cube_message/current"
	CubeFrequencyURL   = "cube/cube_message/frequency"
)

database url

Variables

View Source
var (
	// Adapter mongodb instance
	Adapter database.Adapter
)

Functions

func AnnotationQuery

func AnnotationQuery(params simple_json.AnnotationQueryParams) middleware.Responder

AnnotationQuery POST /annotations

func Error

func Error(err error) middleware.Responder

Error ...

func MetricFindQuery

func MetricFindQuery(params simple_json.MetricFindQueryParams) middleware.Responder

MetricFindQuery POST /search

func MongoAddress

func MongoAddress() string

MongoAddress get mongo address from env(default:"localhost:27017")

func Query

Query POST /query

func TestDatasource

TestDatasource GET /

Types

type Cube

type Cube struct {
	Voltage     int   `json:"voltage,omitempty" bson:"voltage,omitempty"`
	Temperature int   `json:"temperature,omitempty" bson:"temperature,omitempty"`
	Current     int   `json:"current,omitempty" bson:"current,omitempty"`
	Frequency   int   `json:"frequency,omitempty" bson:"frequency,omitempty"`
	Timestamp   int64 `json:"timeStamp,omitempty" bson:"timeStamp,omitempty"`
}

Cube ...

type Timeserie

type Timeserie struct {
	Total     int       `json:"total,omitempty" bson:"total,omitempty"`
	Timestamp time.Time `json:"timestamp,omitempty" bson:"timestamp,omitempty"`
}

Timeserie ...

func GetCubeCurrentTimeserie

func GetCubeCurrentTimeserie(dbName, cName string, options *v1.Query) ([]*Timeserie, error)

GetCubeCurrentTimeserie ...

func GetCubeFrequencyTimeserie

func GetCubeFrequencyTimeserie(dbName, cName string, options *v1.Query) ([]*Timeserie, error)

GetCubeFrequencyTimeserie ...

func GetCubeTemperatureTimeserie

func GetCubeTemperatureTimeserie(dbName, cName string, options *v1.Query) ([]*Timeserie, error)

GetCubeTemperatureTimeserie ...

func GetCubeTimeserie

func GetCubeTimeserie(dbName, cName string, options *v1.Query) ([]*Timeserie, error)

GetCubeTimeserie ...

func GetCubeVoltageTimeserie

func GetCubeVoltageTimeserie(dbName, cName string, options *v1.Query) ([]*Timeserie, error)

GetCubeVoltageTimeserie ...

func GetDevicesTimeserie

func GetDevicesTimeserie(dbName, cName string, options *v1.Query) ([]*Timeserie, error)

GetDevicesTimeserie ...

func GetLogrdbTimeserie

func GetLogrdbTimeserie(dbName, cName string, options *v1.Query) ([]*Timeserie, error)

GetLogrdbTimeserie ...

func GetProductsTimeserie

func GetProductsTimeserie(dbName, cName string, options *v1.Query) ([]*Timeserie, error)

GetProductsTimeserie ...

db.getCollection('products').aggregate([

{
	'$match':{
		'created_at': {'$gte': "2019-03-13T10:30:56Z", '$lte': "2019-03-14T09:25:50Z"}
	}
},
{
	'$group': {
		'_id': {
			'$subtract': [
				{'$toDate': '$created_at'},
				{
					'$mod': [
						{'$toLong': {'$toDate': '$created_at'}},
						60 * 60 * 24 * 1000
					]
				}
			]
		},
		'total': {'$sum': 1}
	}
},
{
	'$project': { '_id': 0, 'timestamp': '$_id', 'total': 1}
},
{
	'$sort': { 'timestamp': 1 }
}

])

func GetUsersTimeserie

func GetUsersTimeserie(dbName, cName string, options *v1.Query) ([]*Timeserie, error)

GetUsersTimeserie ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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