dao

package
v0.0.0-...-cbcc5d9 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const COLLECTION = "hive"
View Source
const DATABASE = "mongodb://localhost:27017"

Variables

This section is empty.

Functions

This section is empty.

Types

type HiveDao

type HiveDao struct {
	Server   string
	Database string
}

func (*HiveDao) GetAllHivesMetrics

func (h *HiveDao) GetAllHivesMetrics() ([]*Hive, error)
func (h *HiveDao) GetAllHiveMetrics()  {
	ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
	c := client.Database("hive").Collection("hive")
		var hives []bson.M
		cursor, err := c.Find(ctx, bson.M{})
		if err!=nil {
			log.Fatal(err)
		}
		if err = cursor.All(ctx,&hives); err != nil {
			log.Fatal(err)
		}
		log.Print(hives)
}

from all hives

Jump to

Keyboard shortcuts

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