mongo

package
v0.0.0-...-685c49b Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Find

func Find(collectionName string, selector map[string]interface{}, inputOptions interface{}, result *[]interface{}) *common.Error

func FindOne

func FindOne(collectionName string, selector map[string]interface{}, result *map[string]interface{}) *common.Error

func Insert

func Insert(collectionName string, doc interface{}, result *[]interface{}) *common.Error

func InvalidObjectIdError

func InvalidObjectIdError(objectId string) *common.Error

func MongoDBError

func MongoDBError(b error) *common.Error

func ObjectAlreadyExistsError

func ObjectAlreadyExistsError(objectName string) *common.Error

func ObjectNotExistsError

func ObjectNotExistsError(objectName string) *common.Error

func Remove

func Remove(collectionName string, selector map[string]interface{}, result *[]interface{}) *common.Error

func SetMongoDBInv

func SetMongoDBInv(mongoDB settings.DBConfig)

func StartMongod

func StartMongod()

func TestMongoConnection

func TestMongoConnection()

func Update

func Update(collectionName string, selector map[string]interface{}, update interface{}, inputOptions interface{}, result *[]interface{}) *common.Error

func Upsert

func Upsert(collectionName string, selector map[string]interface{}, update interface{}, inputOptions interface{}, result *[]interface{}) *common.Error

Types

type AtlasMongo

type AtlasMongo struct {
	Config Database `json:"config"`
	Host   string   `json:"host"`
}

func (*AtlasMongo) GetCollection

func (mi *AtlasMongo) GetCollection(collectionName string) *mongo.Collection

func (*AtlasMongo) GetDatabaseConfig

func (mi *AtlasMongo) GetDatabaseConfig() *Database

func (*AtlasMongo) GetSession

func (mi *AtlasMongo) GetSession() *mongo.Client

type DB

type DB interface {
	GetSession() *mongo.Client
	GetDatabaseConfig() *Database
	GetCollection(collectionName string) *mongo.Collection
}
var Instance DB

type Database

type Database struct {
	Username string `json:"username"`
	Password string `json:"password"`
	Database string `json:"database"`
}

type LocalMongo

type LocalMongo struct {
	Config Database `json:"config"`
	Host   string   `json:"host"`
}

func (*LocalMongo) GetCollection

func (mi *LocalMongo) GetCollection(collectionName string) *mongo.Collection

func (*LocalMongo) GetDatabaseConfig

func (mi *LocalMongo) GetDatabaseConfig() *Database

func (*LocalMongo) GetSession

func (mi *LocalMongo) GetSession() *mongo.Client

Jump to

Keyboard shortcuts

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