Documentation
¶
Index ¶
- func CloseCursor(ctx context.Context, cursor *mongo.Cursor, err *error)
- type Collection
- func (c *Collection) Aggregate(ctx context.Context, pipeline mongo.Pipeline, results interface{}, ...) error
- func (c *Collection) AggregateIterate(ctx context.Context, pipeline mongo.Pipeline, handler IterateHandlerFn, ...) error
- func (c *Collection) Col() *mongo.Collection
- func (c *Collection) Count(ctx context.Context, filter interface{}, opts ...*options.CountOptions) (int64, error)
- func (c *Collection) CountAll(ctx context.Context) (int64, error)
- func (c *Collection) Delete(ctx context.Context, id string) error
- func (c *Collection) Exists(ctx context.Context, id string) (bool, error)
- func (c *Collection) Find(ctx context.Context, filter, results interface{}, opts ...*options.FindOptions) error
- func (c *Collection) FindIterate(ctx context.Context, filter interface{}, handler IterateHandlerFn, ...) error
- func (c *Collection) FindOne(ctx context.Context, filter, result interface{}, ...) error
- func (c *Collection) Get(ctx context.Context, id string, result interface{}, ...) error
- func (c *Collection) Insert(ctx context.Context, entity Entity) error
- func (c *Collection) Upsert(ctx context.Context, id string, entity Entity) error
- type CollectionOption
- func CollectionWithIndexes(v ...mongo.IndexModel) CollectionOption
- func CollectionWithIndexesCommitQuorumString(v string) CollectionOption
- func CollectionWithIndexesCommitQuorumVotingMembers(v context.Context) CollectionOption
- func CollectionWithIndexesContext(v int32) CollectionOption
- func CollectionWithIndexesMaxTime(v time.Duration) CollectionOption
- func CollectionWithIndexesQuorumMajority() CollectionOption
- func CollectionWithReadConcern(v *readconcern.ReadConcern) CollectionOption
- func CollectionWithReadPreference(v *readpref.ReadPref) CollectionOption
- func CollectionWithRegistry(v *bsoncodec.Registry) CollectionOption
- func CollectionWithWriteConcern(v *writeconcern.WriteConcern) CollectionOption
- type CollectionOptions
- type DecodeFn
- type Entity
- type EntityWithTimestamps
- type EntityWithVersion
- type IterateHandlerFn
- type Option
- type Options
- type Persistor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
Collection can only be used in the Persistor.WithCollection call.ss
func NewCollection ¶
func NewCollection(db *mongo.Database, name string, opts ...CollectionOption) (*Collection, error)
func (*Collection) Aggregate ¶
func (c *Collection) Aggregate(ctx context.Context, pipeline mongo.Pipeline, results interface{}, opts ...*options.AggregateOptions) error
Aggregate ...
func (*Collection) AggregateIterate ¶
func (c *Collection) AggregateIterate( ctx context.Context, pipeline mongo.Pipeline, handler IterateHandlerFn, opts ...*options.AggregateOptions, ) error
func (*Collection) Count ¶
func (c *Collection) Count(ctx context.Context, filter interface{}, opts ...*options.CountOptions) (int64, error)
Count returns the count of documents
func (*Collection) CountAll ¶
func (c *Collection) CountAll(ctx context.Context) (int64, error)
CountAll returns the count of all documents
func (*Collection) Find ¶
func (c *Collection) Find(ctx context.Context, filter, results interface{}, opts ...*options.FindOptions) error
Find ...
func (*Collection) FindIterate ¶
func (c *Collection) FindIterate(ctx context.Context, filter interface{}, handler IterateHandlerFn, opts ...*options.FindOptions) error
FindIterate ...
func (*Collection) FindOne ¶
func (c *Collection) FindOne(ctx context.Context, filter, result interface{}, opts ...*options.FindOneOptions) error
FindOne ...
func (*Collection) Get ¶
func (c *Collection) Get(ctx context.Context, id string, result interface{}, opts ...*options.FindOneOptions) error
Get ...
type CollectionOption ¶
type CollectionOption func(*CollectionOptions)
Collection can only be used in the Persistor.WithCollection call.ss
func CollectionWithIndexes ¶
func CollectionWithIndexes(v ...mongo.IndexModel) CollectionOption
func CollectionWithIndexesCommitQuorumString ¶
func CollectionWithIndexesCommitQuorumString(v string) CollectionOption
func CollectionWithIndexesCommitQuorumVotingMembers ¶
func CollectionWithIndexesCommitQuorumVotingMembers(v context.Context) CollectionOption
func CollectionWithIndexesContext ¶
func CollectionWithIndexesContext(v int32) CollectionOption
func CollectionWithIndexesMaxTime ¶
func CollectionWithIndexesMaxTime(v time.Duration) CollectionOption
func CollectionWithIndexesQuorumMajority ¶
func CollectionWithIndexesQuorumMajority() CollectionOption
func CollectionWithReadConcern ¶
func CollectionWithReadConcern(v *readconcern.ReadConcern) CollectionOption
func CollectionWithReadPreference ¶
func CollectionWithReadPreference(v *readpref.ReadPref) CollectionOption
func CollectionWithRegistry ¶
func CollectionWithRegistry(v *bsoncodec.Registry) CollectionOption
func CollectionWithWriteConcern ¶
func CollectionWithWriteConcern(v *writeconcern.WriteConcern) CollectionOption
type CollectionOptions ¶
type CollectionOptions struct { *options.CollectionOptions *options.CreateIndexesOptions Indexes []mongo.IndexModel IndexesContext context.Context }
Collection can only be used in the Persistor.WithCollection call.ss
func DefaultCollectionOptions ¶
func DefaultCollectionOptions() CollectionOptions
type EntityWithTimestamps ¶
type EntityWithVersion ¶
type IterateHandlerFn ¶
type Option ¶
type Option func(o *Options)
Persistor exported to used also for embedding into other types in foreign packages.
func WithClientOptions ¶
func WithClientOptions(v *options.ClientOptions) Option
func WithDatabaseOptions ¶
func WithDatabaseOptions(v *options.DatabaseOptions) Option
func WithOtelEnabled ¶
func WithOtelOptions ¶
func WithOtelServiceName ¶
type Options ¶
type Options struct { OtelEnabled bool OtelServiceName string OtelOptions []otelmongo.Option ClientOptions *options.ClientOptions DatabaseOptions *options.DatabaseOptions }
Persistor exported to used also for embedding into other types in foreign packages.
func DefaultOptions ¶
func DefaultOptions() Options
type Persistor ¶
type Persistor struct {
// contains filtered or unexported fields
}
Persistor exported to used also for embedding into other types in foreign packages.
func (Persistor) Collection ¶
func (p Persistor) Collection(name string, opts ...CollectionOption) (*Collection, error)
func (Persistor) HasCollection ¶
HasCollection checks if the given collection exists
Click to show internal directories.
Click to hide internal directories.