mongox

package
v1.2.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	URL            string // MongoDB Connection URL
	DBName         string
	CollectionName string
}

Options : MongoDB Options

type Provider

type Provider struct {
	MongoDB *Options
	// contains filtered or unexported fields
}

Provider : MongoDB Provider

func New

func New(opts *Options) (*Provider, error)

New Provider Instance

func (*Provider) Close

func (m *Provider) Close() error

Close DB Connection

func (*Provider) Connect

func (m *Provider) Connect() error

Connect : Connect to database

func (*Provider) CreateCollection

func (m *Provider) CreateCollection(collname string) error

CreateCollection : Creates New Collection

func (*Provider) Disconnect

func (m *Provider) Disconnect() error

Disconnect : throws error when fails

func (*Provider) FindAll

func (m *Provider) FindAll() ([]bson.D, error)

FindAll : Find All Possible Matches

func (*Provider) FindOne

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

FindOne : Find One Document using Filter

func (*Provider) FindWhere

func (m *Provider) FindWhere(filter interface{}) ([]bson.D, error)

FindWhere : Find All Possible Matches Where

func (*Provider) Get

func (m *Provider) Get(key string) (string, error)

Get variable value

func (*Provider) GetAllExplicit

func (m *Provider) GetAllExplicit() (map[string]string, error)

GetAllExplicit Variables and their Values

func (*Provider) GetAllImplicit

func (m *Provider) GetAllImplicit() (map[string]string, error)

GetAllImplicit Variables and Values

func (*Provider) GetAllVarNames

func (m *Provider) GetAllVarNames() (map[string]bool, error)

GetAllVarNames

func (*Provider) GetCollection

func (m *Provider) GetCollection(name string)

GetCollection : Get COllection

func (*Provider) GetDatabase

func (m *Provider) GetDatabase(name string)

GetDatabase : Connect to Database

func (*Provider) InsertOne

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

InsertOne : Insert One Document

func (*Provider) Isconnected

func (m *Provider) Isconnected() bool

Isconnected : Check If Connected to Database

func (*Provider) ListDBCollections

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

ListDBCollections : List All Collections of Current Database

func (*Provider) ListDatabases

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

ListDatabases : List all Databases

func (*Provider) PingTest

func (m *Provider) PingTest() error

PingTest : Test Successful Connection

func (*Provider) ProviderName

func (m *Provider) ProviderName() string

ProviderName i.e DB backend here (mongodb)

func (*Provider) Put

func (m *Provider) Put(key, value string, isExplicit bool) error

Put Variable to DB

func (*Provider) UpdateDocument

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

UpdateDocument : Update Existing Document or create New One

Jump to

Keyboard shortcuts

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