mongodb

package
v2.0.0-...-c87de9c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDecodeToNil         = bson.ErrDecodeToNil
	ErrNilContext          = bson.ErrNilContext
	ErrNilReader           = bson.ErrNilReader
	ErrNilRegistry         = bson.ErrNilRegistry
	ErrClientDisconnected  = mongo.ErrClientDisconnected
	ErrEmptySlice          = mongo.ErrEmptySlice
	ErrInvalidIndexValue   = mongo.ErrInvalidIndexValue
	ErrMissingResumeToken  = mongo.ErrMissingResumeToken
	ErrMultipleIndexDrop   = mongo.ErrMultipleIndexDrop
	ErrNilCursor           = mongo.ErrNilCursor
	ErrNilDocument         = mongo.ErrNilDocument
	ErrNoDocuments         = mongo.ErrNoDocuments
	ErrNonStringIndexName  = mongo.ErrNonStringIndexName
	ErrUnacknowledgedWrite = mongo.ErrUnacknowledgedWrite
	ErrWrongClient         = mongo.ErrWrongClient
	ErrParseNaN            = primitive.ErrParseNaN
	ErrParseInf            = primitive.ErrParseInf
	ErrParseNegInf         = primitive.ErrParseNegInf
)
View Source
var (
	CompareTimestamp             = primitive.CompareTimestamp
	NewDateTimeFromTime          = primitive.NewDateTimeFromTime
	NewDecimal128                = primitive.NewDecimal128
	ParseDecimal128              = primitive.ParseDecimal128
	ParseDecimal128FromBigInt    = primitive.ParseDecimal128FromBigInt
	NewObjectID                  = primitive.NewObjectID
	NewObjectIDFromTimestamp     = primitive.NewObjectIDFromTimestamp
	ObjectIDFromHex              = primitive.ObjectIDFromHex
	OptionAggregate              = options.Aggregate
	OptionAutoEncryption         = options.AutoEncryption
	OptionBulkWrite              = options.BulkWrite
	OptionChangeStream           = options.ChangeStream
	OptionClientEncryption       = options.ClientEncryption
	OptionClient                 = options.Client
	OptionCollection             = options.Collection
	OptionCount                  = options.Count
	OptionCreateCollection       = options.CreateCollection
	OptionCreateIndexes          = options.CreateIndexes
	OptionCreateView             = options.CreateView
	OptionDataKey                = options.DataKey
	OptionDatabase               = options.Database
	OptionDefaultIndex           = options.DefaultIndex
	OptionDelete                 = options.Delete
	OptionDistinct               = options.Distinct
	OptionDropIndexes            = options.DropIndexes
	OptionEncrypt                = options.Encrypt
	OptionEstimatedDocumentCount = options.EstimatedDocumentCount
	OptionFindOneAndDelete       = options.FindOneAndDelete
	OptionFindOneAndReplace      = options.FindOneAndReplace
	OptionFindOneAndUpdate       = options.FindOneAndUpdate
	OptionFindOne                = options.FindOne
	OptionFind                   = options.Find
	OptionGridFSFind             = options.GridFSFind
	OptionIndex                  = options.Index
	OptionInsertMany             = options.InsertMany
	OptionInsertOne              = options.InsertOne
	OptionListCollections        = options.ListCollections
	OptionListDatabases          = options.ListDatabases
	OptionListIndexes            = options.ListIndexes
	OptionReplace                = options.Replace
	OptionRunCmd                 = options.RunCmd
	OptionSession                = options.Session
	OptionTransaction            = options.Transaction
	OptionUpdate                 = options.Update
)
View Source
var (
	Default = StdConfig("default").Build()
)

Functions

func Client

func Client() *mongo.Client

func DB

func DB(name string, opts ...*options.DatabaseOptions) *mongo.Database

Types

type A

type A = primitive.A

type AggregateOptions

type AggregateOptions = options.AggregateOptions

type ArrayFilters

type ArrayFilters = options.ArrayFilters

type AutoEncryptionOptions

type AutoEncryptionOptions = options.AutoEncryptionOptions

type Binary

type Binary = primitive.Binary

type BucketOptions

type BucketOptions = options.BucketOptions

type BulkWriteOptions

type BulkWriteOptions = options.BulkWriteOptions

type ChangeStreamOptions

type ChangeStreamOptions = options.ChangeStreamOptions

type ClientEncryptionOptions

type ClientEncryptionOptions = options.ClientEncryptionOptions

type ClientOptions

type ClientOptions = options.ClientOptions

type Collation

type Collation = options.Collation

type Collection

type Collection = mongo.Collection

type CollectionOptions

type CollectionOptions = options.CollectionOptions

type Config

type Config struct {
	URI                  string `config:"uri" desc:"mongodb uri string."`
	EnableCommandMonitor bool   `config:"commandMonitor"`
	EnablePoolMonitor    bool   `config:"poolMonitor"`
	// contains filtered or unexported fields
}

func DefaultConfig

func DefaultConfig(key string) *Config

func StdConfig

func StdConfig(key string, optionFunc ...OptionFunc) *Config

func (*Config) Build

func (c *Config) Build() *Mongo

func (*Config) Path

func (c *Config) Path() string

type ContextDialer

type ContextDialer = options.ContextDialer

type CountOptions

type CountOptions = options.CountOptions

type CreateCollectionOptions

type CreateCollectionOptions = options.CreateCollectionOptions

type CreateIndexesOptions

type CreateIndexesOptions = options.CreateIndexesOptions

type CreateViewOptions

type CreateViewOptions = options.CreateViewOptions

type Credential

type Credential = options.Credential

type Cursor

type Cursor = mongo.Cursor

type CursorType

type CursorType = options.CursorType

type D

type D = primitive.D

type DataKeyOptions

type DataKeyOptions = options.DataKeyOptions

type Database

type Database = mongo.Database

type DatabaseOptions

type DatabaseOptions = options.DatabaseOptions

type DateTime

type DateTime = primitive.DateTime

type Decimal128

type Decimal128 = primitive.Decimal128

type DefaultIndexOptions

type DefaultIndexOptions = options.DefaultIndexOptions

type DeleteOptions

type DeleteOptions = options.DeleteOptions

type DistinctOptions

type DistinctOptions = options.DistinctOptions

type DropIndexesOptions

type DropIndexesOptions = options.DropIndexesOptions

type E

type E = primitive.E

type EncryptOptions

type EncryptOptions = options.EncryptOptions

type EstimatedDocumentCountOptions

type EstimatedDocumentCountOptions = options.EstimatedDocumentCountOptions

type FindOneAndDeleteOptions

type FindOneAndDeleteOptions = options.FindOneAndDeleteOptions

type FindOneAndReplaceOptions

type FindOneAndReplaceOptions = options.FindOneAndReplaceOptions

type FindOneAndUpdateOptions

type FindOneAndUpdateOptions = options.FindOneAndUpdateOptions

type FindOneOptions

type FindOneOptions = options.FindOneOptions

type FindOptions

type FindOptions = options.FindOptions

type FullDocument

type FullDocument = options.FullDocument

type GridFSFindOptions

type GridFSFindOptions = options.GridFSFindOptions

type IndexOptions

type IndexOptions = options.IndexOptions

type InsertManyOptions

type InsertManyOptions = options.InsertManyOptions

type InsertOneOptions

type InsertOneOptions = options.InsertOneOptions

type JavaScript

type JavaScript = primitive.JavaScript

type ListCollectionsOptions

type ListCollectionsOptions = options.ListCollectionsOptions

type ListDatabasesOptions

type ListDatabasesOptions = options.ListDatabasesOptions

type ListIndexesOptions

type ListIndexesOptions = options.ListIndexesOptions

type M

type M = primitive.M

type MarshalError

type MarshalError = options.MarshalError

type MaxKey

type MaxKey = primitive.MaxKey

type MinKey

type MinKey = primitive.MinKey

type Mongo

type Mongo struct {
	// contains filtered or unexported fields
}

func (*Mongo) Client

func (mgo *Mongo) Client() *mongo.Client

func (*Mongo) DB

func (mgo *Mongo) DB(db string, opts ...*options.DatabaseOptions) *mongo.Database

func (*Mongo) Name

func (mgo *Mongo) Name() string

func (*Mongo) Serve

func (mgo *Mongo) Serve(ctx context.Context) error

func (*Mongo) Shutdown

func (mgo *Mongo) Shutdown(ctx context.Context) error

type Monitor

type Monitor interface {
	Setup(*mongo.Client)
	Serve()
	Shutdown()
	Started(context.Context, *event.CommandStartedEvent)
	Succeeded(context.Context, *event.CommandSucceededEvent)
	Failed(context.Context, *event.CommandFailedEvent)
	Event(*event.PoolEvent)
}

type NameOptions

type NameOptions = options.NameOptions

type Null

type Null = primitive.Null

type ObjectID

type ObjectID = primitive.ObjectID

type OptionFunc

type OptionFunc func(*Config)

func WithMonitor

func WithMonitor(monitor Monitor) OptionFunc

type Regex

type Regex = primitive.Regex

type ReplaceOptions

type ReplaceOptions = options.ReplaceOptions

type ReturnDocument

type ReturnDocument = options.ReturnDocument

type RunCmdOptions

type RunCmdOptions = options.RunCmdOptions

type SessionOptions

type SessionOptions = options.SessionOptions

type Symbol

type Symbol = primitive.Symbol

type Timestamp

type Timestamp = primitive.Timestamp

type TransactionOptions

type TransactionOptions = options.TransactionOptions

type Undefined

type Undefined = primitive.Undefined

type UpdateOptions

type UpdateOptions = options.UpdateOptions

type UploadOptions

type UploadOptions = options.UploadOptions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL