database

package
v0.0.0-...-d85ed84 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Context = context.TODO()

Functions

func Init

func Init(mongoConfig *config.MongoConfig) error

Types

type NodeDocument

type NodeDocument struct {
	ID       primitive.ObjectID `bson:"_id,omitempty"` // todo: research about omitempty in bson
	Address  string             `bson:"address"`
	LastSeen time.Time          `bson:"last_seen,omitempty"`
}

type NodesCollection

type NodesCollection struct {
	Collection *mongo.Collection
}
var Nodes NodesCollection

func (*NodesCollection) FindManyByAddress

func (nodes *NodesCollection) FindManyByAddress(address string) []NodeDocument

func (*NodesCollection) GetAll

func (nodes *NodesCollection) GetAll() []NodeDocument

func (*NodesCollection) InsertOne

func (nodes *NodesCollection) InsertOne(address string)

Jump to

Keyboard shortcuts

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