db

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: BSD-3-Clause Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoDB

type MongoDB struct {
	URL string
	// contains filtered or unexported fields
}

MongoDB ...

var MDB MongoDB = MongoDB{}

MDB : Exported MongoDB Instance

func (*MongoDB) Connect

func (m *MongoDB) Connect() error

Connect : Connect to database

func (*MongoDB) Disconnect

func (m *MongoDB) Disconnect()

Disconnect : throws error when fails

func (*MongoDB) DropDatabase

func (m *MongoDB) DropDatabase(name string) error

DropDatabase : Drop a Database

func (*MongoDB) FindAll

func (m *MongoDB) FindAll() ([]interface{}, error)

FindAll : Find All Possible Matches

func (*MongoDB) FindOne

func (m *MongoDB) FindOne(filter interface{}, data interface{}) (interface{}, error)

FindOne : Find One Document using Filter

func (*MongoDB) GetCollInstance

func (m *MongoDB) GetCollInstance() *mongo.Collection

GetCollInstance : Get Collection Instance

func (*MongoDB) GetCollection

func (m *MongoDB) GetCollection(name string)

GetCollection : Get COllection

func (*MongoDB) GetDatabase

func (m *MongoDB) GetDatabase(name string)

GetDatabase : Connect to Database

func (*MongoDB) InitializeProject

func (m *MongoDB) InitializeProject() error

InitializeProject : Initalize Project According to Sandman Needs

func (*MongoDB) InsertOne

func (m *MongoDB) InsertOne(dat interface{}) error

InsertOne : Insert One Document

func (MongoDB) Isconnected

func (m MongoDB) Isconnected() bool

Isconnected : Check If Connected to Database

func (*MongoDB) ListDBCollections

func (m *MongoDB) ListDBCollections() ([]string, error)

ListDBCollections : List All Collections of Current Database

func (*MongoDB) ListDatabases

func (m *MongoDB) ListDatabases() ([]string, error)

ListDatabases : List all Databases

func (MongoDB) PingTest

func (m MongoDB) PingTest() error

PingTest : Test Successful Connection

func (*MongoDB) TempConnection

func (m *MongoDB) TempConnection(db string) *mongo.Database

TempConnection : Create a temp connection to different database

func (*MongoDB) UpdateDocument

func (m *MongoDB) UpdateDocument(filter interface{}, dat interface{}) (*mongo.UpdateResult, error)

UpdateDocument : Update Existing Document or create New One

func (*MongoDB) ValidateProject

func (m *MongoDB) ValidateProject() bool

ValidateProject : Just Check if Files are as intended by application

Jump to

Keyboard shortcuts

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