Documentation
¶
Index ¶
- func BsonDeserialize(ex interface{}) gotask.Middleware
- func BsonSerialize() gotask.Middleware
- func ErrorFilter() gotask.Middleware
- type AggregateCmd
- type BulkWriteCmd
- type Cmd
- type Config
- type CountDocumentsCmd
- type CreateIndexCmd
- type CreateIndexesCmd
- type DeleteManyCmd
- type DeleteOneCmd
- type DistinctCmd
- type DropCmd
- type DropIndexCmd
- type DropIndexesCmd
- type FindCmd
- type FindOneAndDeleteCmd
- type FindOneAndReplaceCmd
- type FindOneAndUpdateCmd
- type FindOneCmd
- type InsertManyCmd
- type InsertOneCmd
- type ListIndexesCmd
- type MongoProxy
- func (m *MongoProxy) Aggregate(payload []byte, result *[]byte) error
- func (m *MongoProxy) BulkWrite(payload []byte, result *[]byte) error
- func (m *MongoProxy) CountDocuments(payload []byte, result *[]byte) error
- func (m *MongoProxy) CreateIndex(payload []byte, result *[]byte) error
- func (m *MongoProxy) CreateIndexes(payload []byte, result *[]byte) error
- func (m *MongoProxy) DeleteMany(payload []byte, result *[]byte) error
- func (m *MongoProxy) DeleteOne(payload []byte, result *[]byte) error
- func (m *MongoProxy) Distinct(payload []byte, result *[]byte) error
- func (m *MongoProxy) Drop(payload []byte, result *[]byte) error
- func (m *MongoProxy) DropIndex(payload []byte, result *[]byte) error
- func (m *MongoProxy) DropIndexes(payload []byte, result *[]byte) error
- func (m *MongoProxy) Find(payload []byte, result *[]byte) error
- func (m *MongoProxy) FindOne(payload []byte, result *[]byte) error
- func (m *MongoProxy) FindOneAndDelete(payload []byte, result *[]byte) error
- func (m *MongoProxy) FindOneAndReplace(payload []byte, result *[]byte) error
- func (m *MongoProxy) FindOneAndUpdate(payload []byte, result *[]byte) error
- func (m *MongoProxy) InsertMany(payload []byte, result *[]byte) (err error)
- func (m *MongoProxy) InsertOne(payload []byte, result *[]byte) (err error)
- func (m *MongoProxy) ListIndexes(payload []byte, result *[]byte) error
- func (m *MongoProxy) ReplaceOne(payload []byte, result *[]byte) error
- func (m *MongoProxy) RunCommand(payload []byte, result *[]byte) error
- func (m *MongoProxy) RunCommandCursor(payload []byte, result *[]byte) error
- func (m *MongoProxy) UpdateMany(payload []byte, result *[]byte) error
- func (m *MongoProxy) UpdateOne(payload []byte, result *[]byte) error
- type ReplaceOneCmd
- type UpdateManyCmd
- type UpdateOneCmd
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BsonDeserialize ¶ added in v2.2.0
func BsonDeserialize(ex interface{}) gotask.Middleware
BsonDeserialize deserializes bson cmd into a struct cmd
func BsonSerialize ¶ added in v2.2.0
func BsonSerialize() gotask.Middleware
BsonSerialize serializes any result into a bson encoded result
func ErrorFilter ¶ added in v2.2.0
func ErrorFilter() gotask.Middleware
Types ¶
type AggregateCmd ¶
type BulkWriteCmd ¶ added in v2.2.0
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 CreateIndexCmd ¶ added in v2.2.0
type CreateIndexCmd struct { Database string Collection string IndexKeys bson.Raw Opts *options.IndexOptions CreateOpts *options.CreateIndexesOptions }
type CreateIndexesCmd ¶ added in v2.2.0
type CreateIndexesCmd struct { Database string Collection string Models []mongo.IndexModel Opts *options.IndexOptions CreateOpts *options.CreateIndexesOptions }
type DeleteManyCmd ¶
type DeleteOneCmd ¶
type DistinctCmd ¶ added in v2.2.0
type DropIndexCmd ¶ added in v2.2.0
type DropIndexCmd struct { Database string Collection string Name string Opts *options.DropIndexesOptions }
type DropIndexesCmd ¶ added in v2.2.0
type DropIndexesCmd struct { Database string Collection string Opts *options.DropIndexesOptions }
type FindOneAndDeleteCmd ¶ added in v2.2.0
type FindOneAndReplaceCmd ¶ added in v2.2.0
type FindOneAndUpdateCmd ¶ added in v2.2.0
type FindOneCmd ¶
type InsertManyCmd ¶
type InsertManyCmd struct { Database string Collection string Records []interface{} Opts *options.InsertManyOptions }
type InsertOneCmd ¶
type ListIndexesCmd ¶ added in v2.2.0
type ListIndexesCmd struct { Database string Collection string Opts *options.ListIndexesOptions }
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 []byte, result *[]byte) error
Aggregate executes an aggregate command against the collection and returns all the resulting documents.
func (*MongoProxy) BulkWrite ¶ added in v2.2.0
func (m *MongoProxy) BulkWrite(payload []byte, result *[]byte) error
func (*MongoProxy) CountDocuments ¶
func (m *MongoProxy) CountDocuments(payload []byte, result *[]byte) error
CountDocuments returns the number of documents in the collection.
func (*MongoProxy) CreateIndex ¶ added in v2.2.0
func (m *MongoProxy) CreateIndex(payload []byte, result *[]byte) error
func (*MongoProxy) CreateIndexes ¶ added in v2.2.0
func (m *MongoProxy) CreateIndexes(payload []byte, result *[]byte) error
func (*MongoProxy) DeleteMany ¶
func (m *MongoProxy) DeleteMany(payload []byte, result *[]byte) error
DeleteMany executes a delete command to delete documents from the collection.
func (*MongoProxy) DeleteOne ¶
func (m *MongoProxy) DeleteOne(payload []byte, result *[]byte) error
DeleteOne executes a delete command to delete at most one document from the collection.
func (*MongoProxy) Distinct ¶ added in v2.2.0
func (m *MongoProxy) Distinct(payload []byte, result *[]byte) error
Distinct executes a distinct command to find the unique values for a specified field in the collection.
func (*MongoProxy) Drop ¶
func (m *MongoProxy) Drop(payload []byte, result *[]byte) 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) DropIndex ¶ added in v2.2.0
func (m *MongoProxy) DropIndex(payload []byte, result *[]byte) error
func (*MongoProxy) DropIndexes ¶ added in v2.2.0
func (m *MongoProxy) DropIndexes(payload []byte, result *[]byte) error
func (*MongoProxy) Find ¶
func (m *MongoProxy) Find(payload []byte, result *[]byte) error
Find executes a find command and returns all the matching documents in the collection.
func (*MongoProxy) FindOne ¶
func (m *MongoProxy) FindOne(payload []byte, result *[]byte) error
FindOne executes a find command and returns one document in the collection.
func (*MongoProxy) FindOneAndDelete ¶ added in v2.2.0
func (m *MongoProxy) FindOneAndDelete(payload []byte, result *[]byte) error
FindOneAndDelete executes a findAndModify command to delete at most one document in the collection. and returns the document as it appeared before deletion.
func (*MongoProxy) FindOneAndReplace ¶ added in v2.2.0
func (m *MongoProxy) FindOneAndReplace(payload []byte, result *[]byte) error
FindOneAndReplace executes a findAndModify command to replace at most one document in the collection and returns the document as it appeared before replacement.
func (*MongoProxy) FindOneAndUpdate ¶ added in v2.2.0
func (m *MongoProxy) FindOneAndUpdate(payload []byte, result *[]byte) error
FindOneAndUpdate executes a findAndModify command to update at most one document in the collection and returns the document as it appeared before updating.
func (*MongoProxy) InsertMany ¶
func (m *MongoProxy) InsertMany(payload []byte, result *[]byte) (err 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 []byte, result *[]byte) (err error)
InsertOne executes an insert command to insert a single document into the collection.
func (*MongoProxy) ListIndexes ¶ added in v2.2.0
func (m *MongoProxy) ListIndexes(payload []byte, result *[]byte) error
func (*MongoProxy) ReplaceOne ¶
func (m *MongoProxy) ReplaceOne(payload []byte, result *[]byte) error
ReplaceOne executes an update command to replace at most one document in the collection.
func (*MongoProxy) RunCommand ¶
func (m *MongoProxy) RunCommand(payload []byte, result *[]byte) error
RunCommand executes the given command against the database.
func (*MongoProxy) RunCommandCursor ¶
func (m *MongoProxy) RunCommandCursor(payload []byte, result *[]byte) 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 []byte, result *[]byte) error
UpdateMany executes an update command to update documents in the collection.