Documentation ¶
Overview ¶
Copyright 2018, OpenCensus Authors
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func DefaultConfig() *config
- func InterceptorChain(interceptors ...Interceptor) func(oldProcess processFn) processFn
- type Client
- func (wc *Client) Client() *mongo.Client
- func (wc *Client) Connect(ctx context.Context) error
- func (wc *Client) Database(name string, opts ...*options.DatabaseOptions) *Database
- func (wc *Client) Disconnect(ctx context.Context) error
- func (wc *Client) ListDatabaseNames(ctx context.Context, filter interface{}, opts ...*options.ListDatabasesOptions) (dbs []string, err error)
- func (wc *Client) ListDatabases(ctx context.Context, filter interface{}, opts ...*options.ListDatabasesOptions) (dbr mongo.ListDatabasesResult, err error)
- func (wc *Client) NewClientEncryption(opts ...*options.ClientEncryptionOptions) (*ClientEncryption, error)
- func (wc *Client) Ping(ctx context.Context, rp *readpref.ReadPref) error
- func (wc *Client) StartSession(opts ...*options.SessionOptions) (ss mongo.Session, err error)
- func (wc *Client) UseSession(ctx context.Context, fn func(mongo.SessionContext) error) error
- func (wc *Client) UseSessionWithOptions(ctx context.Context, opts *options.SessionOptions, ...) error
- type ClientEncryption
- func (wce *ClientEncryption) Close(ctx context.Context) error
- func (wce *ClientEncryption) CreateDataKey(ctx context.Context, kmsProvider string, opts ...*options.DataKeyOptions) (id primitive.Binary, err error)
- func (wce *ClientEncryption) Decrypt(ctx context.Context, val primitive.Binary) (value bson.RawValue, err error)
- func (wce *ClientEncryption) Encrypt(ctx context.Context, val bson.RawValue, opts ...*options.EncryptOptions) (value primitive.Binary, err error)
- type Collection
- func (wc *Collection) Aggregate(ctx context.Context, pipeline interface{}, opts ...*options.AggregateOptions) (res *mongo.Cursor, err error)
- func (wc *Collection) BulkWrite(ctx context.Context, models []mongo.WriteModel, ...) (res *mongo.BulkWriteResult, err error)
- func (wc *Collection) Clone(opts ...*options.CollectionOptions) (res *mongo.Collection, err error)
- func (wc *Collection) Collection() *mongo.Collection
- func (wc *Collection) CountDocuments(ctx context.Context, filter interface{}, opts ...*options.CountOptions) (res int64, err error)
- func (wc *Collection) Database() *mongo.Database
- func (wc *Collection) DeleteMany(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (res *mongo.DeleteResult, err error)
- func (wc *Collection) DeleteOne(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (res *mongo.DeleteResult, err error)
- func (wc *Collection) Distinct(ctx context.Context, fieldName string, filter interface{}, ...) (res []interface{}, err error)
- func (wc *Collection) Drop(ctx context.Context) error
- func (wc *Collection) EstimatedDocumentCount(ctx context.Context, opts ...*options.EstimatedDocumentCountOptions) (res int64, err error)
- func (wc *Collection) Find(ctx context.Context, filter interface{}, opts ...*options.FindOptions) (res *mongo.Cursor, err error)
- func (wc *Collection) FindOne(ctx context.Context, filter interface{}, opts ...*options.FindOneOptions) (res *mongo.SingleResult)
- func (wc *Collection) FindOneAndDelete(ctx context.Context, filter interface{}, ...) (res *mongo.SingleResult)
- func (wc *Collection) FindOneAndReplace(ctx context.Context, filter, replacement interface{}, ...) (res *mongo.SingleResult)
- func (wc *Collection) FindOneAndUpdate(ctx context.Context, filter, update interface{}, ...) (res *mongo.SingleResult)
- func (wc *Collection) Indexes() mongo.IndexView
- func (wc *Collection) InsertMany(ctx context.Context, documents []interface{}, ...) (res *mongo.InsertManyResult, err error)
- func (wc *Collection) InsertOne(ctx context.Context, document interface{}, opts ...*options.InsertOneOptions) (res *mongo.InsertOneResult, err error)
- func (wc *Collection) Name() string
- func (wc *Collection) ReplaceOne(ctx context.Context, filter, replacement interface{}, ...) (res *mongo.UpdateResult, err error)
- func (wc *Collection) UpdateMany(ctx context.Context, filter, replacement interface{}, ...) (res *mongo.UpdateResult, err error)
- func (wc *Collection) UpdateOne(ctx context.Context, filter, replacement interface{}, ...) (res *mongo.UpdateResult, err error)
- func (wc *Collection) Watch(ctx context.Context, pipeline interface{}, ...) (res *mongo.ChangeStream, err error)
- type Component
- type Container
- type Database
- func (wd *Database) Client() *Client
- func (wd *Database) Collection(name string, opts ...*options.CollectionOptions) *Collection
- func (wd *Database) Database() *mongo.Database
- func (wd *Database) Drop(ctx context.Context) error
- func (wd *Database) ListCollections(ctx context.Context, filter interface{}, ...) (cur *mongo.Cursor, err error)
- func (wd *Database) Name() string
- func (wd *Database) ReadConcern() *readconcern.ReadConcern
- func (wd *Database) ReadPreference() *readpref.ReadPref
- func (wd *Database) RunCommand(ctx context.Context, runCommand interface{}, opts ...*options.RunCmdOptions) (res *mongo.SingleResult)
- func (wd *Database) WriteConcern() (res *writeconcern.WriteConcern)
- type Interceptor
- type Option
- type Session
- func (ws *Session) AbortTransaction(ctx context.Context) error
- func (ws *Session) AdvanceClusterTime(br bson.Raw) error
- func (ws *Session) AdvanceOperationTime(pt *primitive.Timestamp) error
- func (ws *Session) ClusterTime() (raw bson.Raw)
- func (ws *Session) CommitTransaction(ctx context.Context) error
- func (ws *Session) EndSession(ctx context.Context)
- func (ws *Session) OperationTime() (ts *primitive.Timestamp)
- func (ws *Session) StartTransaction(topts ...*options.TransactionOptions) error
Constants ¶
View Source
const PackageName = "component.emongo"
Variables ¶
This section is empty.
Functions ¶
func InterceptorChain ¶
func InterceptorChain(interceptors ...Interceptor) func(oldProcess processFn) processFn
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Database ¶
func (wc *Client) Database(name string, opts ...*options.DatabaseOptions) *Database
func (*Client) ListDatabaseNames ¶
func (*Client) ListDatabases ¶
func (wc *Client) ListDatabases(ctx context.Context, filter interface{}, opts ...*options.ListDatabasesOptions) ( dbr mongo.ListDatabasesResult, err error)
func (*Client) NewClientEncryption ¶
func (wc *Client) NewClientEncryption(opts ...*options.ClientEncryptionOptions) (*ClientEncryption, error)
func (*Client) StartSession ¶
func (*Client) UseSession ¶
func (*Client) UseSessionWithOptions ¶
func (wc *Client) UseSessionWithOptions(ctx context.Context, opts *options.SessionOptions, fn func(mongo.SessionContext) error) error
type ClientEncryption ¶
type ClientEncryption struct {
// contains filtered or unexported fields
}
func (*ClientEncryption) CreateDataKey ¶
func (wce *ClientEncryption) CreateDataKey(ctx context.Context, kmsProvider string, opts ...*options.DataKeyOptions) ( id primitive.Binary, err error)
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
func (*Collection) Aggregate ¶
func (wc *Collection) Aggregate(ctx context.Context, pipeline interface{}, opts ...*options.AggregateOptions) (res *mongo.Cursor, err error)
func (*Collection) BulkWrite ¶
func (wc *Collection) BulkWrite(ctx context.Context, models []mongo.WriteModel, opts ...*options.BulkWriteOptions) ( res *mongo.BulkWriteResult, err error)
func (*Collection) Clone ¶
func (wc *Collection) Clone(opts ...*options.CollectionOptions) (res *mongo.Collection, err error)
func (*Collection) Collection ¶
func (wc *Collection) Collection() *mongo.Collection
func (*Collection) CountDocuments ¶
func (wc *Collection) CountDocuments(ctx context.Context, filter interface{}, opts ...*options.CountOptions) (res int64, err error)
func (*Collection) Database ¶
func (wc *Collection) Database() *mongo.Database
func (*Collection) DeleteMany ¶
func (wc *Collection) DeleteMany(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) ( res *mongo.DeleteResult, err error)
func (*Collection) DeleteOne ¶
func (wc *Collection) DeleteOne(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (res *mongo.DeleteResult, err error)
func (*Collection) Distinct ¶
func (wc *Collection) Distinct(ctx context.Context, fieldName string, filter interface{}, opts ...*options.DistinctOptions) (res []interface{}, err error)
func (*Collection) EstimatedDocumentCount ¶
func (wc *Collection) EstimatedDocumentCount(ctx context.Context, opts ...*options.EstimatedDocumentCountOptions) (res int64, err error)
func (*Collection) Find ¶
func (wc *Collection) Find(ctx context.Context, filter interface{}, opts ...*options.FindOptions) (res *mongo.Cursor, err error)
func (*Collection) FindOne ¶
func (wc *Collection) FindOne(ctx context.Context, filter interface{}, opts ...*options.FindOneOptions) (res *mongo.SingleResult)
func (*Collection) FindOneAndDelete ¶
func (wc *Collection) FindOneAndDelete(ctx context.Context, filter interface{}, opts ...*options.FindOneAndDeleteOptions) (res *mongo.SingleResult)
func (*Collection) FindOneAndReplace ¶
func (wc *Collection) FindOneAndReplace(ctx context.Context, filter, replacement interface{}, opts ...*options.FindOneAndReplaceOptions) (res *mongo.SingleResult)
func (*Collection) FindOneAndUpdate ¶
func (wc *Collection) FindOneAndUpdate(ctx context.Context, filter, update interface{}, opts ...*options.FindOneAndUpdateOptions) (res *mongo.SingleResult)
func (*Collection) Indexes ¶
func (wc *Collection) Indexes() mongo.IndexView
func (*Collection) InsertMany ¶
func (wc *Collection) InsertMany(ctx context.Context, documents []interface{}, opts ...*options.InsertManyOptions) (res *mongo.InsertManyResult, err error)
func (*Collection) InsertOne ¶
func (wc *Collection) InsertOne(ctx context.Context, document interface{}, opts ...*options.InsertOneOptions) (res *mongo.InsertOneResult, err error)
func (*Collection) Name ¶
func (wc *Collection) Name() string
func (*Collection) ReplaceOne ¶
func (wc *Collection) ReplaceOne(ctx context.Context, filter, replacement interface{}, opts ...*options.ReplaceOptions) (res *mongo.UpdateResult, err error)
func (*Collection) UpdateMany ¶
func (wc *Collection) UpdateMany(ctx context.Context, filter, replacement interface{}, opts ...*options.UpdateOptions) (res *mongo.UpdateResult, err error)
func (*Collection) UpdateOne ¶
func (wc *Collection) UpdateOne(ctx context.Context, filter, replacement interface{}, opts ...*options.UpdateOptions) (res *mongo.UpdateResult, err error)
func (*Collection) Watch ¶
func (wc *Collection) Watch(ctx context.Context, pipeline interface{}, opts ...*options.ChangeStreamOptions) (res *mongo.ChangeStream, err error)
type Component ¶
type Component struct {
// contains filtered or unexported fields
}
Component client (cmdable and config)
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func (*Database) Collection ¶
func (wd *Database) Collection(name string, opts ...*options.CollectionOptions) *Collection
func (*Database) ListCollections ¶
func (*Database) ReadConcern ¶
func (wd *Database) ReadConcern() *readconcern.ReadConcern
func (*Database) ReadPreference ¶
func (*Database) RunCommand ¶
func (wd *Database) RunCommand(ctx context.Context, runCommand interface{}, opts ...*options.RunCmdOptions) (res *mongo.SingleResult)
func (*Database) WriteConcern ¶
func (wd *Database) WriteConcern() (res *writeconcern.WriteConcern)
type Interceptor ¶
type Interceptor func(oldProcessFn processFn) (newProcessFn processFn)
type Option ¶
type Option func(c *Container)
func WithInterceptor ¶
func WithInterceptor(interceptors ...Interceptor) Option
WithInterceptor 注入拦截器
type Session ¶
func (*Session) AdvanceOperationTime ¶
func (*Session) ClusterTime ¶
func (*Session) EndSession ¶
func (*Session) OperationTime ¶
func (*Session) StartTransaction ¶
func (ws *Session) StartTransaction(topts ...*options.TransactionOptions) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.