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 ¶
func BsonDeserialize(ex interface{}) gotask.Middleware
BsonDeserialize deserializes bson cmd into a struct cmd
func BsonSerialize ¶
func BsonSerialize() gotask.Middleware
BsonSerialize serializes any result into a bson encoded result
func ErrorFilter ¶
func ErrorFilter() gotask.Middleware
Types ¶
type AggregateCmd ¶
type AggregateCmd struct {
Database string
Collection string
Pipeline mongo.Pipeline
Opts *options.AggregateOptions
OptsList options.Lister[options.AggregateOptions]
}
type BulkWriteCmd ¶
type Cmd ¶
type Cmd struct {
Database string
Command bson.D
Opts *options.RunCmdOptions
OptsList options.Lister[options.RunCmdOptions]
}
type Config ¶
type Config struct {
Uri string
ConnectTimeout time.Duration
ReadWriteTimeout time.Duration
Database string
Username string
Password string
Mechanism string
AuthSource string
MaxPoolSize uint64
MinPoolSize uint64
}
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 bson.Raw
Opts *options.CountOptions
OptsList options.Lister[options.CountOptions]
}
type CreateIndexCmd ¶
type CreateIndexCmd struct {
Database string
Collection string
IndexKeys bson.Raw
Opts *options.IndexOptionsBuilder
CreateOpts *options.CreateIndexesOptions
OptsList options.Lister[options.CreateIndexesOptions]
}
type CreateIndexesCmd ¶
type CreateIndexesCmd struct {
Database string
Collection string
Models []mongo.IndexModel
Opts *options.IndexOptions
CreateOpts *options.CreateIndexesOptions
OptsList options.Lister[options.CreateIndexesOptions]
}
type DeleteManyCmd ¶
type DeleteManyCmd struct {
Database string
Collection string
Filter bson.Raw
Opts *options.DeleteManyOptions
OptsList options.Lister[options.DeleteManyOptions]
}
type DeleteOneCmd ¶
type DeleteOneCmd struct {
Database string
Collection string
Filter bson.Raw
Opts *options.DeleteOneOptions
OptsList options.Lister[options.DeleteOneOptions]
}
type DistinctCmd ¶
type DropIndexCmd ¶
type DropIndexCmd struct {
Database string
Collection string
Name string
Opts *options.DropIndexesOptions
OptsList options.Lister[options.DropIndexesOptions]
}
type DropIndexesCmd ¶
type DropIndexesCmd struct {
Database string
Collection string
Opts *options.DropIndexesOptions
OptsList options.Lister[options.DropIndexesOptions]
}
type FindCmd ¶
type FindCmd struct {
Database string
Collection string
Filter bson.Raw
Opts *options.FindOptions
OptsList options.Lister[options.FindOptions]
}
type FindOneAndDeleteCmd ¶
type FindOneAndDeleteCmd struct {
Database string
Collection string
Filter bson.Raw
Opts *options.FindOneAndDeleteOptions
OptsList options.Lister[options.FindOneAndDeleteOptions]
}
type FindOneAndReplaceCmd ¶
type FindOneAndUpdateCmd ¶
type FindOneCmd ¶
type FindOneCmd struct {
Database string
Collection string
Filter bson.Raw
Opts *options.FindOneOptions
OptsList options.Lister[options.FindOneOptions]
}
type InsertManyCmd ¶
type InsertManyCmd struct {
Database string
Collection string
Records []interface{}
Opts *options.InsertManyOptions
OptsList options.Lister[options.InsertManyOptions]
}
type InsertOneCmd ¶
type InsertOneCmd struct {
Database string
Collection string
Record bson.Raw
Opts *options.InsertOneOptions
OptsList options.Lister[options.InsertOneOptions]
}
type ListIndexesCmd ¶
type ListIndexesCmd struct {
Database string
Collection string
Opts *options.ListIndexesOptions
OptsList options.Lister[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) CountDocuments ¶
func (m *MongoProxy) CountDocuments(payload []byte, result *[]byte) error
CountDocuments returns the number of documents in the collection.
func (*MongoProxy) CreateIndex ¶
func (m *MongoProxy) CreateIndex(payload []byte, result *[]byte) error
func (*MongoProxy) CreateIndexes ¶
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 ¶
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) DropIndexes ¶
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 ¶
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 ¶
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 ¶
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 ¶
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.