Versions in this module Expand all Collapse all v0 v0.1.5 Apr 30, 2021 Changes in this version type Option + func WithDebug(debug bool) Option v0.1.4 Jan 7, 2021 Changes in this version + const PackageName + func InterceptorChain(interceptors ...Interceptor) func(oldProcess processFn) processFn + type Client struct + func Connect(ctx context.Context, opts ...*options.ClientOptions) (wc *Client, err error) + func NewClient(opts ...*options.ClientOptions) (*Client, error) + 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 struct + 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 struct + 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 struct + Client *Client + Config *Config + type Config struct + DSN string + Debug bool + PoolLimit int + SocketTimeout time.Duration + func DefaultConfig() *Config + type Container struct + func DefaultContainer() *Container + func Load(key string) *Container + func (c *Container) Build(options ...Option) *Component + type Database struct + 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 func(oldProcessFn processFn) (newProcessFn processFn) + type Option func(c *Container) + func WithDSN(dsn string) Option + func WithInterceptor(interceptors ...Interceptor) Option + type Session struct + 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