mongodb

package
v1.2.17 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Deprecated: As of corepkgv2 tag 1.2.15 onwards no longer maintained,simply use coremongo and in future it will be removed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteSession

func DeleteSession(hostName string) error

DeleteSession -DeleteSession

func GetMongoConnection

func GetMongoConnection(hostName string) (*mgo.Session, error)

GetMongoConnection method

func Init

func Init(tomlFilepath, defaultHostName string) error

Init initializes Mongo Connections for give toml file

func InitNewSession

func InitNewSession(hostDetails MongoHost) error

InitNewSession - InitNewSession

func InitUsingJSON

func InitUsingJSON(configs []MongoHost) error

InitUsingJSON initializes Mongo Connections for give JSON data

Types

type MongoDAO

type MongoDAO struct {
	// contains filtered or unexported fields
}

MongoDAO mongo DAO struct

func GetMongoDAO

func GetMongoDAO(collection string) *MongoDAO

GetMongoDAO return mongo DAO instance

func GetMongoDAOWithHost

func GetMongoDAOWithHost(host, collection string) *MongoDAO

GetMongoDAOWithHost return mongo DAO instance

func (*MongoDAO) BulkDeleteData

func (mg *MongoDAO) BulkDeleteData(data []interface{}) error

BulkDeleteData delete data in mongo db in bulk

func (*MongoDAO) BulkSaveData

func (mg *MongoDAO) BulkSaveData(data []interface{}) error

BulkSaveData ata Save data in mongo db in bulk

func (*MongoDAO) BulkUpdateData

func (mg *MongoDAO) BulkUpdateData(data []interface{}) error

BulkUpdateData update data in mongo db in bulk

func (*MongoDAO) BulkUpsertData

func (mg *MongoDAO) BulkUpsertData(data []interface{}) error

BulkUpsertData Upsert data in mongo db in bulk

func (*MongoDAO) CustomUpdate

func (mg *MongoDAO) CustomUpdate(selector map[string]interface{}, data interface{}) error

CustomUpdate - CustomUpdate

func (*MongoDAO) CustomUpdateOne

func (mg *MongoDAO) CustomUpdateOne(selector map[string]interface{}, data interface{}) error

CustomUpdateOne - CustomUpdateOne

func (*MongoDAO) DeleteAll

func (mg *MongoDAO) DeleteAll(selector map[string]interface{}) error

DeleteAll will delete all the matching data given for selector

func (*MongoDAO) DeleteData

func (mg *MongoDAO) DeleteData(selector map[string]interface{}) error

DeleteData will delete data given for selector

func (*MongoDAO) GetAggregateData

func (mg *MongoDAO) GetAggregateData(selector interface{}) (*gjson.Result, error)

GetAggregateData - return result using aggregation query

func (*MongoDAO) GetData

func (mg *MongoDAO) GetData(selector map[string]interface{}) (*gjson.Result, error)

GetData will return query for selector

func (*MongoDAO) GetProjectedData

func (mg *MongoDAO) GetProjectedData(selector map[string]interface{}, projector map[string]interface{}) (*gjson.Result, error)

GetProjectedData will return query for selector and projector

func (*MongoDAO) PushData

func (mg *MongoDAO) PushData(selector map[string]interface{}, data interface{}) error

PushData - append in array

func (*MongoDAO) SaveData

func (mg *MongoDAO) SaveData(data interface{}) error

SaveData Save data in mongo db

func (*MongoDAO) Update

func (mg *MongoDAO) Update(selector map[string]interface{}, data interface{}) error

Update will update single entry

func (*MongoDAO) UpdateAll

func (mg *MongoDAO) UpdateAll(selector map[string]interface{}, data interface{}) error

UpdateAll update all

func (*MongoDAO) Upsert

func (mg *MongoDAO) Upsert(selector map[string]interface{}, data interface{}) error

Upsert will update single entry

type MongoHost

type MongoHost struct {
	HostName        string        `json:"hostName"`
	Server          string        `json:"server"`
	Port            int           `json:"port"`
	Username        string        `json:"username"`
	Password        string        `json:"password"`
	Database        string        `json:"database"`
	IsDefault       bool          `json:"isDefault"`
	MaxIdleConns    int           `json:"maxIdleConns" `
	MaxOpenConns    int           `json:"maxOpenConns"`
	ConnMaxLifetime time.Duration `json:"connMaxLifetime" `
	IsDisabled      bool          `json:"isDisabled" `
}

MongoHost -MongoHost

type TomlConfig

type TomlConfig struct {
	MongoHosts map[string]MongoHost
}

TomlConfig - TomlConfig

Jump to

Keyboard shortcuts

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