Documentation ¶
Index ¶
- func CloseConnection()
- func Ctx() context.Context
- func DB() *mongo.Database
- type DeleteResponse
- type FindResponse
- type InsertResponse
- type Item
- func (item *Item) Collection() *mongo.Collection
- func (item *Item) Delete(criteria map[string]interface{}) *DeleteResponse
- func (item *Item) Drop()
- func (item *Item) Find(criteria map[string]interface{}) *FindResponse
- func (item *Item) InsertMany(elements []map[string]interface{}) InsertResponse
- func (item *Item) InsertOne(element map[string]interface{}) *InsertResponse
- func (item *Item) Update(criteria map[string]interface{}, updated map[string]interface{}) *UpdateResponse
- type MongoEngine
- type UpdateResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DeleteResponse ¶
DeleteResponse Encapsulates the response of a Delete operation
type FindResponse ¶
type FindResponse struct { Status bool `json:"status"` Length int `json:"length"` Items []map[string]interface{} `json:"items"` }
FindResponse Encapsulates the response of a Find operation
type InsertResponse ¶
type InsertResponse struct { Status bool `json:"status"` Length int `json:"length"` Items []interface{} `json:"items"` }
InsertResponse Encapsulates the response of an Insert operation
type Item ¶
type Item struct {
CollectionName string
}
Item Encapsulates a collection
func (*Item) Collection ¶
func (item *Item) Collection() *mongo.Collection
Collection Returns the collection associated to this class
func (*Item) Delete ¶
func (item *Item) Delete(criteria map[string]interface{}) *DeleteResponse
Delete Deletes the given element from the current collection
func (*Item) Find ¶
func (item *Item) Find(criteria map[string]interface{}) *FindResponse
Find Find the items that fit the criteria
func (*Item) InsertMany ¶
func (item *Item) InsertMany(elements []map[string]interface{}) InsertResponse
InsertMany Inserts multiple elements in the current collection
func (*Item) InsertOne ¶
func (item *Item) InsertOne(element map[string]interface{}) *InsertResponse
InsertOne Inserts one element in the current collection
type MongoEngine ¶
type MongoEngine struct { Client *mongo.Client Database string // contains filtered or unexported fields }
MongoEngine Encapsulates a Mongo client with its database name
type UpdateResponse ¶
type UpdateResponse struct { Status bool `json:"status"` Modified int `json:"modified"` Matched int `json:"matched"` }
UpdateResponse Encapsulates the response of an Update operation
Click to show internal directories.
Click to hide internal directories.