Documentation
¶
Index ¶
- type AggregateCmd
- type Cmd
- type Config
- type CountDocumentsCmd
- type DeleteManyCmd
- type DeleteOneCmd
- type DropCmd
- type FindCmd
- type FindOneCmd
- type InsertManyCmd
- type InsertOneCmd
- type MongoProxy
- func (m *MongoProxy) Aggregate(payload AggregateCmd, result *[]map[string]interface{}) error
- func (m *MongoProxy) CountDocuments(payload CountDocumentsCmd, result *interface{}) error
- func (m *MongoProxy) DeleteMany(payload DeleteManyCmd, result *interface{}) error
- func (m *MongoProxy) DeleteOne(payload DeleteOneCmd, result *interface{}) error
- func (m *MongoProxy) Drop(payload DropCmd, result *interface{}) error
- func (m *MongoProxy) Find(payload FindCmd, result *[]map[string]interface{}) error
- func (m *MongoProxy) FindOne(payload FindOneCmd, result *map[string]interface{}) error
- func (m *MongoProxy) InsertMany(payload InsertManyCmd, result *interface{}) error
- func (m *MongoProxy) InsertOne(payload InsertOneCmd, result *interface{}) error
- func (m *MongoProxy) ReplaceOne(payload ReplaceOneCmd, result *interface{}) error
- func (m *MongoProxy) RunCommand(payload Cmd, result *map[string]interface{}) error
- func (m *MongoProxy) RunCommandCursor(payload Cmd, result *[]map[string]interface{}) error
- func (m *MongoProxy) UpdateMany(payload UpdateManyCmd, result *interface{}) error
- func (m *MongoProxy) UpdateOne(payload UpdateOneCmd, result *interface{}) error
- type ReplaceOneCmd
- type UpdateManyCmd
- type UpdateOneCmd
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregateCmd ¶
type AggregateCmd struct { Database string Collection string Pipeline []interface{} Opts []*options.AggregateOptions }
type Cmd ¶
type Cmd struct { Database string Command interface{} Opts []*options.RunCmdOptions }
type Config ¶
func LoadConfig ¶
func LoadConfig() Config
LoadConfig loads Configurations from environmental variables or config file in PHP. Environmental variables takes priority.
type CountDocumentsCmd ¶
type CountDocumentsCmd struct { Database string Collection string Filter interface{} Opts []*options.CountOptions }
type DeleteManyCmd ¶
type DeleteManyCmd struct { Database string Collection string Filter interface{} Opts []*options.DeleteOptions }
type DeleteOneCmd ¶
type DeleteOneCmd struct { Database string Collection string Filter interface{} Opts []*options.DeleteOptions }
type FindCmd ¶
type FindCmd struct { Database string Collection string Filter interface{} Opts []*options.FindOptions }
type FindOneCmd ¶
type FindOneCmd struct { Database string Collection string Filter interface{} Opts []*options.FindOneOptions }
type InsertManyCmd ¶
type InsertManyCmd struct { Database string Collection string Records []interface{} Opts []*options.InsertManyOptions }
type InsertOneCmd ¶
type InsertOneCmd struct { Database string Collection string Record interface{} Opts []*options.InsertOneOptions }
type MongoProxy ¶
type MongoProxy struct {
// contains filtered or unexported fields
}
func NewMongoProxy ¶
func NewMongoProxy(client *mongo.Client) *MongoProxy
NewMongoProxy creates a new Mongo Proxy
func NewMongoProxyWithTimeout ¶
func NewMongoProxyWithTimeout(client *mongo.Client, timeout time.Duration) *MongoProxy
NewMongoProxyWithTimeout creates a new Mongo Proxy, with a read write timeout.
func (*MongoProxy) Aggregate ¶
func (m *MongoProxy) Aggregate(payload AggregateCmd, result *[]map[string]interface{}) error
Aggregate executes an aggregate command against the collection and returns all the resulting documents.
func (*MongoProxy) CountDocuments ¶
func (m *MongoProxy) CountDocuments(payload CountDocumentsCmd, result *interface{}) error
CountDocuments returns the number of documents in the collection.
func (*MongoProxy) DeleteMany ¶
func (m *MongoProxy) DeleteMany(payload DeleteManyCmd, result *interface{}) error
DeleteMany executes a delete command to delete documents from the collection.
func (*MongoProxy) DeleteOne ¶
func (m *MongoProxy) DeleteOne(payload DeleteOneCmd, result *interface{}) error
DeleteOne executes a delete command to delete at most one document from the collection.
func (*MongoProxy) Drop ¶
func (m *MongoProxy) Drop(payload DropCmd, result *interface{}) error
Drop drops the collection on the server. This method ignores "namespace not found" errors so it is safe to drop a collection that does not exist on the server.
func (*MongoProxy) Find ¶
func (m *MongoProxy) Find(payload FindCmd, result *[]map[string]interface{}) error
Find executes a find command and returns all the matching documents in the collection.
func (*MongoProxy) FindOne ¶
func (m *MongoProxy) FindOne(payload FindOneCmd, result *map[string]interface{}) error
FindOne executes a find command and returns one document in the collection.
func (*MongoProxy) InsertMany ¶
func (m *MongoProxy) InsertMany(payload InsertManyCmd, result *interface{}) error
InsertMany executes an insert command to insert multiple documents into the collection. If write errors occur during the operation (e.g. duplicate key error), this method returns a BulkWriteException error.
func (*MongoProxy) InsertOne ¶
func (m *MongoProxy) InsertOne(payload InsertOneCmd, result *interface{}) error
InsertOne executes an insert command to insert a single document into the collection.
func (*MongoProxy) ReplaceOne ¶
func (m *MongoProxy) ReplaceOne(payload ReplaceOneCmd, result *interface{}) error
ReplaceOne executes an update command to replace at most one document in the collection.
func (*MongoProxy) RunCommand ¶
func (m *MongoProxy) RunCommand(payload Cmd, result *map[string]interface{}) error
RunCommand executes the given command against the database.
func (*MongoProxy) RunCommandCursor ¶
func (m *MongoProxy) RunCommandCursor(payload Cmd, result *[]map[string]interface{}) error
RunCommandCursor executes the given command against the database and parses the response as a slice. If the command being executed does not return a slice, the command will be executed on the server and an error will be returned because the server response cannot be parsed as a slice.
func (*MongoProxy) UpdateMany ¶
func (m *MongoProxy) UpdateMany(payload UpdateManyCmd, result *interface{}) error
UpdateMany executes an update command to update documents in the collection.
func (*MongoProxy) UpdateOne ¶
func (m *MongoProxy) UpdateOne(payload UpdateOneCmd, result *interface{}) error
UpdateOne executes an update command to update at most one document in the collection.
type ReplaceOneCmd ¶
type ReplaceOneCmd struct { Database string Collection string Filter interface{} Replace interface{} Opts []*options.ReplaceOptions }
type UpdateManyCmd ¶
type UpdateManyCmd struct { Database string Collection string Filter interface{} Update interface{} Opts []*options.UpdateOptions }
type UpdateOneCmd ¶
type UpdateOneCmd struct { Database string Collection string Filter interface{} Update interface{} Opts []*options.UpdateOptions }