db

package
v0.0.0-...-7b465e8 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

README

db

Package exporting connection to MongoDB for the goltar program

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(db *DB) error

Connect opens a connection to the database

func Disconnect

func Disconnect(db *DB)

Disconnect closes a connection to the database typically used with defer

Types

type DB

type DB struct {
	Collection *mongo.Collection

	Ctx context.Context
	// contains filtered or unexported fields
}

DB holds the information for the current database, collection and client

func OpenDB

func OpenDB(database string, collection string) (*DB, error)

OpenDB attempts to estblish a client link the provided database and collection. It assumes that a localhost MongoDB server.

Jump to

Keyboard shortcuts

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