Documentation ¶
Index ¶
- type Config
- type WrappedClient
- func (wc *WrappedClient) Client() *mongo.Client
- func (wc *WrappedClient) Database(name string, opts ...*options.DatabaseOptions) *WrappedDatabase
- func (wc *WrappedClient) Disconnect(ctx context.Context) error
- func (wc *WrappedClient) ListDatabaseNames(ctx context.Context, filter interface{}, opts ...*options.ListDatabasesOptions) ([]string, error)
- func (wc *WrappedClient) ListDatabases(ctx context.Context, filter interface{}, opts ...*options.ListDatabasesOptions) (mongo.ListDatabasesResult, error)
- func (wc *WrappedClient) NewClientEncryption(opts ...*options.ClientEncryptionOptions) (*WrappedClientEncryption, error)
- func (wc *WrappedClient) Ping(ctx context.Context, rp *readpref.ReadPref) error
- func (wc *WrappedClient) StartSession(opts ...*options.SessionOptions) (mongo.Session, error)
- func (wc *WrappedClient) UseSession(ctx context.Context, fn func(mongo.SessionContext) error) error
- func (wc *WrappedClient) UseSessionWithOptions(ctx context.Context, opts *options.SessionOptions, ...) error
- type WrappedClientEncryption
- func (wce *WrappedClientEncryption) Close(ctx context.Context) error
- func (wce *WrappedClientEncryption) CreateDataKey(ctx context.Context, kmsProvider string, opts ...*options.DataKeyOptions) (primitive.Binary, error)
- func (wce *WrappedClientEncryption) Decrypt(ctx context.Context, val primitive.Binary) (bson.RawValue, error)
- func (wce *WrappedClientEncryption) Encrypt(ctx context.Context, val bson.RawValue, opts ...*options.EncryptOptions) (primitive.Binary, error)
- type WrappedCollection
- func (w *WrappedCollection) Aggregate(ctx context.Context, pipeline interface{}, opts ...*options.AggregateOptions) (*mongo.Cursor, error)
- func (w *WrappedCollection) BulkWrite(ctx context.Context, models []mongo.WriteModel, ...) (*mongo.BulkWriteResult, error)
- func (w *WrappedCollection) Clone(opts ...*options.CollectionOptions) (*mongo.Collection, error)
- func (w *WrappedCollection) Collection() *mongo.Collection
- func (w *WrappedCollection) Count(ctx context.Context, filter interface{}, opts ...*options.CountOptions) (int64, error)
- func (w *WrappedCollection) CountDocuments(ctx context.Context, filter interface{}, opts ...*options.CountOptions) (int64, error)
- func (w *WrappedCollection) Database() *mongo.Database
- func (w *WrappedCollection) DeleteMany(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
- func (w *WrappedCollection) DeleteOne(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
- func (w *WrappedCollection) Distinct(ctx context.Context, fieldName string, filter interface{}, ...) ([]interface{}, error)
- func (w *WrappedCollection) Drop(ctx context.Context) error
- func (w *WrappedCollection) EstimatedDocumentCount(ctx context.Context, opts ...*options.EstimatedDocumentCountOptions) (int64, error)
- func (w *WrappedCollection) Find(ctx context.Context, filter interface{}, opts ...*options.FindOptions) (*mongo.Cursor, error)
- func (w *WrappedCollection) FindOne(ctx context.Context, filter interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult
- func (w *WrappedCollection) FindOneAndDelete(ctx context.Context, filter interface{}, ...) *mongo.SingleResult
- func (w *WrappedCollection) FindOneAndReplace(ctx context.Context, filter, replacement interface{}, ...) *mongo.SingleResult
- func (w *WrappedCollection) FindOneAndUpdate(ctx context.Context, filter, update interface{}, ...) *mongo.SingleResult
- func (w *WrappedCollection) Indexes() mongo.IndexView
- func (w *WrappedCollection) InsertMany(ctx context.Context, documents []interface{}, ...) (*mongo.InsertManyResult, error)
- func (w *WrappedCollection) InsertOne(ctx context.Context, document interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)
- func (w *WrappedCollection) Name() string
- func (w *WrappedCollection) ReplaceOne(ctx context.Context, filter, replacement interface{}, ...) (*mongo.UpdateResult, error)
- func (w *WrappedCollection) UpdateMany(ctx context.Context, filter, replacement interface{}, ...) (*mongo.UpdateResult, error)
- func (w *WrappedCollection) UpdateOne(ctx context.Context, filter, replacement interface{}, ...) (*mongo.UpdateResult, error)
- func (w *WrappedCollection) Watch(ctx context.Context, pipeline interface{}, ...) (*mongo.ChangeStream, error)
- type WrappedDatabase
- func (wd *WrappedDatabase) Client() *WrappedClient
- func (wd *WrappedDatabase) Collection(name string, opts ...*options.CollectionOptions) *WrappedCollection
- func (wd *WrappedDatabase) Database() *mongo.Database
- func (wd *WrappedDatabase) Drop(ctx context.Context) error
- func (wd *WrappedDatabase) ListCollections(ctx context.Context, filter interface{}, ...) (*mongo.Cursor, error)
- func (wd *WrappedDatabase) Name() string
- func (wd *WrappedDatabase) ReadConcern() *readconcern.ReadConcern
- func (wd *WrappedDatabase) ReadPreference() *readpref.ReadPref
- func (wd *WrappedDatabase) RunCommand(ctx context.Context, runCommand interface{}, opts ...*options.RunCmdOptions) *mongo.SingleResult
- func (wd *WrappedDatabase) WriteConcern() *writeconcern.WriteConcern
- type WrappedSession
- func (w *WrappedSession) AbortTransaction(ctx context.Context) error
- func (w *WrappedSession) AdvanceClusterTime(br bson.Raw) error
- func (w *WrappedSession) AdvanceOperationTime(pt *primitive.Timestamp) error
- func (w *WrappedSession) ClusterTime() bson.Raw
- func (w *WrappedSession) CommitTransaction(ctx context.Context) error
- func (w *WrappedSession) EndSession(ctx context.Context)
- func (w *WrappedSession) OperationTime() *primitive.Timestamp
- func (w *WrappedSession) StartTransaction(opts ...*options.TransactionOptions) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Username string `json:"username" yaml:"username"` Password string `json:"password" yaml:"password"` Address string `json:"address" yaml:"address"` SlowThreshold time.Duration `json:"slowThreshold" yaml:"slowThreshold"` //慢日志阈值 单位:毫秒 Debug bool `json:"debug" yaml:"debug"` //是否打印调试日志 DisableMetric bool `json:"disableMetric" yaml:"disableMetric"` //是否进行监控 DisableTrace bool `json:"disableTrace" yaml:"disableTrace"` //是否进行链路追踪 }
func DefaultConfig ¶
func DefaultConfig() Config
type WrappedClient ¶
type WrappedClient struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(config *Config) (*WrappedClient, error)
func (*WrappedClient) Client ¶
func (wc *WrappedClient) Client() *mongo.Client
func (*WrappedClient) Database ¶
func (wc *WrappedClient) Database(name string, opts ...*options.DatabaseOptions) *WrappedDatabase
func (*WrappedClient) Disconnect ¶
func (wc *WrappedClient) Disconnect(ctx context.Context) error
func (*WrappedClient) ListDatabaseNames ¶
func (wc *WrappedClient) ListDatabaseNames(ctx context.Context, filter interface{}, opts ...*options.ListDatabasesOptions) ([]string, error)
func (*WrappedClient) ListDatabases ¶
func (wc *WrappedClient) ListDatabases(ctx context.Context, filter interface{}, opts ...*options.ListDatabasesOptions) (mongo.ListDatabasesResult, error)
func (*WrappedClient) NewClientEncryption ¶
func (wc *WrappedClient) NewClientEncryption(opts ...*options.ClientEncryptionOptions) (*WrappedClientEncryption, error)
func (*WrappedClient) StartSession ¶
func (wc *WrappedClient) StartSession(opts ...*options.SessionOptions) (mongo.Session, error)
func (*WrappedClient) UseSession ¶
func (wc *WrappedClient) UseSession(ctx context.Context, fn func(mongo.SessionContext) error) error
func (*WrappedClient) UseSessionWithOptions ¶
func (wc *WrappedClient) UseSessionWithOptions(ctx context.Context, opts *options.SessionOptions, fn func(mongo.SessionContext) error) error
type WrappedClientEncryption ¶
type WrappedClientEncryption struct {
// contains filtered or unexported fields
}
func (*WrappedClientEncryption) Close ¶
func (wce *WrappedClientEncryption) Close(ctx context.Context) error
func (*WrappedClientEncryption) CreateDataKey ¶
func (wce *WrappedClientEncryption) CreateDataKey(ctx context.Context, kmsProvider string, opts ...*options.DataKeyOptions) (primitive.Binary, error)
type WrappedCollection ¶
type WrappedCollection struct {
// contains filtered or unexported fields
}
func (*WrappedCollection) Aggregate ¶
func (w *WrappedCollection) Aggregate(ctx context.Context, pipeline interface{}, opts ...*options.AggregateOptions) (*mongo.Cursor, error)
func (*WrappedCollection) BulkWrite ¶
func (w *WrappedCollection) BulkWrite(ctx context.Context, models []mongo.WriteModel, opts ...*options.BulkWriteOptions) (*mongo.BulkWriteResult, error)
func (*WrappedCollection) Clone ¶
func (w *WrappedCollection) Clone(opts ...*options.CollectionOptions) (*mongo.Collection, error)
func (*WrappedCollection) Collection ¶
func (w *WrappedCollection) Collection() *mongo.Collection
func (*WrappedCollection) Count ¶
func (w *WrappedCollection) Count(ctx context.Context, filter interface{}, opts ...*options.CountOptions) (int64, error)
func (*WrappedCollection) CountDocuments ¶
func (w *WrappedCollection) CountDocuments(ctx context.Context, filter interface{}, opts ...*options.CountOptions) (int64, error)
func (*WrappedCollection) Database ¶
func (w *WrappedCollection) Database() *mongo.Database
func (*WrappedCollection) DeleteMany ¶
func (w *WrappedCollection) DeleteMany(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
func (*WrappedCollection) DeleteOne ¶
func (w *WrappedCollection) DeleteOne(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
func (*WrappedCollection) Distinct ¶
func (w *WrappedCollection) Distinct(ctx context.Context, fieldName string, filter interface{}, opts ...*options.DistinctOptions) ([]interface{}, error)
func (*WrappedCollection) EstimatedDocumentCount ¶
func (w *WrappedCollection) EstimatedDocumentCount(ctx context.Context, opts ...*options.EstimatedDocumentCountOptions) (int64, error)
func (*WrappedCollection) Find ¶
func (w *WrappedCollection) Find(ctx context.Context, filter interface{}, opts ...*options.FindOptions) (*mongo.Cursor, error)
func (*WrappedCollection) FindOne ¶
func (w *WrappedCollection) FindOne(ctx context.Context, filter interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult
func (*WrappedCollection) FindOneAndDelete ¶
func (w *WrappedCollection) FindOneAndDelete(ctx context.Context, filter interface{}, opts ...*options.FindOneAndDeleteOptions) *mongo.SingleResult
func (*WrappedCollection) FindOneAndReplace ¶
func (w *WrappedCollection) FindOneAndReplace(ctx context.Context, filter, replacement interface{}, opts ...*options.FindOneAndReplaceOptions) *mongo.SingleResult
func (*WrappedCollection) FindOneAndUpdate ¶
func (w *WrappedCollection) FindOneAndUpdate(ctx context.Context, filter, update interface{}, opts ...*options.FindOneAndUpdateOptions) *mongo.SingleResult
func (*WrappedCollection) Indexes ¶
func (w *WrappedCollection) Indexes() mongo.IndexView
func (*WrappedCollection) InsertMany ¶
func (w *WrappedCollection) InsertMany(ctx context.Context, documents []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)
func (*WrappedCollection) InsertOne ¶
func (w *WrappedCollection) InsertOne(ctx context.Context, document interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)
func (*WrappedCollection) Name ¶
func (w *WrappedCollection) Name() string
func (*WrappedCollection) ReplaceOne ¶
func (w *WrappedCollection) ReplaceOne(ctx context.Context, filter, replacement interface{}, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error)
func (*WrappedCollection) UpdateMany ¶
func (w *WrappedCollection) UpdateMany(ctx context.Context, filter, replacement interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
func (*WrappedCollection) UpdateOne ¶
func (w *WrappedCollection) UpdateOne(ctx context.Context, filter, replacement interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
func (*WrappedCollection) Watch ¶
func (w *WrappedCollection) Watch(ctx context.Context, pipeline interface{}, opts ...*options.ChangeStreamOptions) (*mongo.ChangeStream, error)
type WrappedDatabase ¶
type WrappedDatabase struct {
// contains filtered or unexported fields
}
func (*WrappedDatabase) Client ¶
func (wd *WrappedDatabase) Client() *WrappedClient
func (*WrappedDatabase) Collection ¶
func (wd *WrappedDatabase) Collection(name string, opts ...*options.CollectionOptions) *WrappedCollection
func (*WrappedDatabase) Database ¶
func (wd *WrappedDatabase) Database() *mongo.Database
func (*WrappedDatabase) ListCollections ¶
func (wd *WrappedDatabase) ListCollections(ctx context.Context, filter interface{}, opts ...*options.ListCollectionsOptions) (*mongo.Cursor, error)
func (*WrappedDatabase) Name ¶
func (wd *WrappedDatabase) Name() string
func (*WrappedDatabase) ReadConcern ¶
func (wd *WrappedDatabase) ReadConcern() *readconcern.ReadConcern
func (*WrappedDatabase) ReadPreference ¶
func (wd *WrappedDatabase) ReadPreference() *readpref.ReadPref
func (*WrappedDatabase) RunCommand ¶
func (wd *WrappedDatabase) RunCommand(ctx context.Context, runCommand interface{}, opts ...*options.RunCmdOptions) *mongo.SingleResult
func (*WrappedDatabase) WriteConcern ¶
func (wd *WrappedDatabase) WriteConcern() *writeconcern.WriteConcern
type WrappedSession ¶
func (*WrappedSession) AbortTransaction ¶
func (w *WrappedSession) AbortTransaction(ctx context.Context) error
func (*WrappedSession) AdvanceClusterTime ¶
func (w *WrappedSession) AdvanceClusterTime(br bson.Raw) error
func (*WrappedSession) AdvanceOperationTime ¶
func (w *WrappedSession) AdvanceOperationTime(pt *primitive.Timestamp) error
func (*WrappedSession) ClusterTime ¶
func (w *WrappedSession) ClusterTime() bson.Raw
func (*WrappedSession) CommitTransaction ¶
func (w *WrappedSession) CommitTransaction(ctx context.Context) error
func (*WrappedSession) EndSession ¶
func (w *WrappedSession) EndSession(ctx context.Context)
func (*WrappedSession) OperationTime ¶
func (w *WrappedSession) OperationTime() *primitive.Timestamp
func (*WrappedSession) StartTransaction ¶
func (w *WrappedSession) StartTransaction(opts ...*options.TransactionOptions) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.