mongodb_3k

package module
v0.0.0-...-8d190cf Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: MIT Imports: 12 Imported by: 0

README

mongodb_3k

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoDB3k

type MongoDB3k struct {
	Client     *mongo.Client     `json:"client,omitempty"`
	Context    context.Context   `json:"context,omitempty"`
	Database   *mongo.Database   `json:"database,omitempty"`
	Collection *mongo.Collection `json:"collection,omitempty"`
}

func New

func New(uri string, timout time.Duration, ctx context.Context) *MongoDB3k

New This method is used to initialize the mongo.Client

func (*MongoDB3k) ExportCSV

func (r *MongoDB3k) ExportCSV() *os.File

ExportCSV This method is used to export the collection to a csv file

func (*MongoDB3k) ExportXLSX

func (r *MongoDB3k) ExportXLSX()

ExportXLSX This method is used to export the collection to a xlsx file

func (*MongoDB3k) ImportCSV

func (r *MongoDB3k) ImportCSV(csvPath string, idColumn int)

ImportCSV This method is used to import a csv file into the collection

func (*MongoDB3k) Ping

func (r *MongoDB3k) Ping() error

Ping This method is used to ping the mongo.Client

func (*MongoDB3k) SetCollection

func (r *MongoDB3k) SetCollection(collectionName string)

SetCollection This method is used to set the collection

func (*MongoDB3k) SetDatabase

func (r *MongoDB3k) SetDatabase(databaseName string)

SetDatabase This method is used to set the database

func (*MongoDB3k) VerifyCollection

func (r *MongoDB3k) VerifyCollection() error

VerifyCollection This method is used to verify that the collection is set

Jump to

Keyboard shortcuts

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