mongo

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DuplicateCh chan DuplicateRequest

Functions

This section is empty.

Types

type Client

type Client struct {
	Config *types.StorageConfig
	Host   *mongo.Client
	Ctx    context.Context
}

func NewMongoClient

func NewMongoClient(config *types.StorageConfig) (*Client, error)

func (Client) Aggregate

func (c Client) Aggregate(collectionName string, pipeline interface{}) (*types.FindResult, error)

func (Client) CreateIndexes added in v1.0.7

func (c Client) CreateIndexes(collectionName string, data interface{}) ([]string, error)

func (Client) DropIndexes added in v1.1.2

func (c Client) DropIndexes(collectionName string) ([]interface{}, error)

func (Client) Duplicate

func (c Client) Duplicate(method string, request types.IRequest, data interface{})

func (Client) DuplicateProcessor

func (c Client) DuplicateProcessor()

func (Client) Find

func (c Client) Find(collectionName string, selector map[string]interface{}, inputOptions *types.Options, includeFields []string) (*types.FindResult, error)

func (Client) FindOne

func (c Client) FindOne(collectionName string, selector map[string]interface{}) (map[string]interface{}, error)

func (Client) GetCollection

func (c Client) GetCollection(collectionName string) *mongo.Collection

func (Client) GetIndexes added in v1.0.7

func (c Client) GetIndexes(collectionName string) ([]interface{}, error)

func (Client) Insert

func (c Client) Insert(collectionName string, doc interface{}) (*mongo.InsertOneResult, error)

func (Client) InsertMany

func (c Client) InsertMany(collectionName string, docs []interface{}) (*mongo.InsertManyResult, error)

func (Client) Remove

func (c Client) Remove(collectionName string, selector map[string]interface{}) error

func (Client) Update

func (c Client) Update(collectionName string, selector map[string]interface{}, update interface{}) (*mongo.UpdateResult, error)

func (Client) Upsert

func (c Client) Upsert(collectionName string, selector map[string]interface{}, update interface{}) error

type DuplicateData

type DuplicateData struct {
	Method    string      `json:"method"`
	Data      interface{} `json:"data"`
	Processed interface{} `json:"processed"`
}

type DuplicateRequest

type DuplicateRequest struct {
	Method string        `json:"method"`
	Data   DuplicateData `json:"data"`
}

type IndexData added in v1.0.7

type IndexData struct {
	Keys   []bson.M `bson:"keys" json:"keys"`
	Unique bool     `bson:"unique" json:"unique"`
}

type IndexElement added in v1.0.7

type IndexElement struct {
	Key   string      `json:"key" bson:"key"`
	Value interface{} `json:"value" bson:"value"`
}

type IndexesData added in v1.0.7

type IndexesData []IndexData

Jump to

Keyboard shortcuts

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