adi

package module
v0.0.0-...-9205b54 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	Groups []AGroup
	Hosts  []HostVars
}

type Group

type Group struct {
	ID         primitive.ObjectID `bson:"_id,omitempty"`
	Children   []string           `bson:"children"`
	Datacenter string             `bson:"datacenter"`
	Name       string             `bson:"name"`
	Hosts      []string           `bson:"hosts"`
	Vars       map[string]interface{}
}

type HostVars

type HostVars struct {
	ID   primitive.ObjectID `bson:"_id,omitempty"`
	Name string             `bson:"name"`
	Vars map[string]interface{}
}

type MongoDB

type MongoDB struct {
	Client *mongo.Client
	Ctx    context.Context
	DB     *mongo.Database

	// Add fields for collections here
	MyCollection *mongo.Collection
}

MongoDB connection struct

func NewMongoDB

func NewMongoDB(ctx context.Context, uri, dbName string, collection string) (*MongoDB, error)

NewMongoDB creates a new MongoDB connection

func (*MongoDB) Close

func (db *MongoDB) Close() error

Close closes the MongoDB connection

Jump to

Keyboard shortcuts

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