Documentation ¶
Index ¶
- type MongoClient
- func (c *MongoClient) Aggregate(collection string, pipeline mongo.Pipeline, object interface{}) error
- func (m *MongoClient) Close(ctx context.Context) error
- func (c *MongoClient) Delete(collection string, filter *db.Filter) error
- func (c *MongoClient) Exists(collection string, filter interface{}) (bool, error)
- func (c *MongoClient) Find(collection, param string, value interface{}, object interface{}) error
- func (m *MongoClient) FindAll(collection string, object interface{}, filter *db.Filter, opts *db.Options) error
- func (c *MongoClient) FindAllWithBSON(collection string, filter interface{}, opts *options.FindOptions, ...) error
- func (m *MongoClient) FindOne(collection string, object interface{}, filter *db.Filter, opts *db.Options) error
- func (c *MongoClient) FindWithBSON(collection string, filter interface{}, opts *options.FindOneOptions, ...) error
- func (c *MongoClient) Insert(collection string, object interface{}) error
- func (m *MongoClient) Open(ctx context.Context) error
- func (c *MongoClient) Search(collection, search string, fields []string, slice interface{}) error
- func (m *MongoClient) Update(collection string, object interface{}, filter *db.Filter) error
- func (c *MongoClient) UpdateWithBSON(collection string, filter, update interface{}) error
- func (c *MongoClient) Upsert(collection string, object interface{}, filter *db.Filter) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MongoClient ¶
MongoClient holds the connection to the database
func NewMongoClient ¶
func NewMongoClient(dbName string, collections []string, opts *options.ClientOptions, searchIndices map[string](map[string]bool)) (*MongoClient, error)
NewMongoClient makes a connection with the mongo client
func (*MongoClient) Aggregate ¶
func (c *MongoClient) Aggregate(collection string, pipeline mongo.Pipeline, object interface{}) error
Aggregate takes in a collection string, filter, pipeline, and pointer to object returns error if anything is malformed
func (*MongoClient) Delete ¶
func (c *MongoClient) Delete(collection string, filter *db.Filter) error
Delete deletes the certain document based on param and value
func (*MongoClient) Exists ¶
func (c *MongoClient) Exists(collection string, filter interface{}) (bool, error)
Exists checks if the document exists within the collection based on the filter
func (*MongoClient) Find ¶
func (c *MongoClient) Find(collection, param string, value interface{}, object interface{}) error
Find takes collection, param & value to build filter, and object pointer to receive data
func (*MongoClient) FindAll ¶
func (m *MongoClient) FindAll(collection string, object interface{}, filter *db.Filter, opts *db.Options) error
FindAll finds all within the collection, using filter and options if applicable
func (*MongoClient) FindAllWithBSON ¶
func (c *MongoClient) FindAllWithBSON(collection string, filter interface{}, opts *options.FindOptions, slice interface{}) error
FindAllWithBSON takes collection string, bson filter, options.FindOptions and decodes into pointer to the slice
func (*MongoClient) FindWithBSON ¶
func (c *MongoClient) FindWithBSON(collection string, filter interface{}, opts *options.FindOneOptions, object interface{}) error
FindWithBSON takes in object and already made bson filter
func (*MongoClient) Insert ¶
func (c *MongoClient) Insert(collection string, object interface{}) error
Insert takes a collection name and interface object and inserts into collection
func (*MongoClient) Search ¶
func (c *MongoClient) Search(collection, search string, fields []string, slice interface{}) error
Search takes a collection, search string, and slice of fields to search upon. The results are unmarshalled into slice interface
func (*MongoClient) Update ¶
func (m *MongoClient) Update(collection string, object interface{}, filter *db.Filter) error
func (*MongoClient) UpdateWithBSON ¶
func (c *MongoClient) UpdateWithBSON(collection string, filter, update interface{}) error
UpdateWithBSON takes in collection string & bson filter and update object