collection

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyIndex = errors.New("mongo: create index is empty")
)

Functions

This section is empty.

Types

type Builder

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

func NewBuilder

func NewBuilder(db *mongo.Database, name string) *Builder

func (*Builder) ReadConcern

func (b *Builder) ReadConcern(rc *readconcern.ReadConcern) *Builder

ReadConcern sets the value for the ReadConcern field.

func (*Builder) ReadPreference

func (b *Builder) ReadPreference(rp *readpref.ReadPref) *Builder

ReadPreference sets the value for the ReadPreference field.

func (*Builder) Registry

func (b *Builder) Registry(r *bsoncodec.Registry) *Builder

Registry sets the value for the Registry field.

func (*Builder) WriteConcern

func (b *Builder) WriteConcern(wc *writeconcern.WriteConcern) *Builder

WriteConcern sets the value for the WriteConcern field.

type IndexCreateBuilder

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

func (*IndexCreateBuilder) CommitQuorumInt

func (c *IndexCreateBuilder) CommitQuorumInt(quorum int32) *IndexCreateBuilder

CommitQuorumInt sets the value for the CommitQuorum field as an int32.

func (*IndexCreateBuilder) CommitQuorumMajority

func (c *IndexCreateBuilder) CommitQuorumMajority() *IndexCreateBuilder

CommitQuorumMajority sets the value for the CommitQuorum to special "majority" value.

func (*IndexCreateBuilder) CommitQuorumString

func (c *IndexCreateBuilder) CommitQuorumString(quorum string) *IndexCreateBuilder

CommitQuorumString sets the value for the CommitQuorum field as a string.

func (*IndexCreateBuilder) CommitQuorumVotingMembers

func (c *IndexCreateBuilder) CommitQuorumVotingMembers() *IndexCreateBuilder

CommitQuorumVotingMembers sets the value for the CommitQuorum to special "votingMembers" value.

func (*IndexCreateBuilder) Execute

func (c *IndexCreateBuilder) Execute(ctx context.Context) ([]string, error)

func (*IndexCreateBuilder) MaxTime

MaxTime sets the value for the MaxTime field.

NOTE(benjirewis): MaxTime will be deprecated in a future release. The more general Timeout option may be used in its place to control the amount of time that a single operation can run before returning an error. MaxTime is ignored if Timeout is set on the client.

type IndexDropBuilder

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

func (*IndexDropBuilder) Execute

func (d *IndexDropBuilder) Execute(ctx context.Context) (bson.Raw, error)

func (*IndexDropBuilder) MaxTime

func (d *IndexDropBuilder) MaxTime(duration time.Duration) *IndexDropBuilder

type IndexListBuilder

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

func (*IndexListBuilder) BatchSize

func (l *IndexListBuilder) BatchSize(i int32) *IndexListBuilder

BatchSize sets the value for the BatchSize field.

func (*IndexListBuilder) Execute

func (l *IndexListBuilder) Execute(ctx context.Context) ([]*mongo.IndexModel, error)

func (*IndexListBuilder) ExecuteSpecifications

func (l *IndexListBuilder) ExecuteSpecifications(ctx context.Context) ([]*mongo.IndexSpecification, error)

func (*IndexListBuilder) SetMaxTime

func (l *IndexListBuilder) SetMaxTime(d time.Duration) *IndexListBuilder

SetMaxTime sets the value for the MaxTime field.

NOTE(benjirewis): MaxTime will be deprecated in a future release. The more general Timeout option may be used in its place to control the amount of time that a single operation can run before returning an error. MaxTime is ignored if Timeout is set on the client.

type IndexViewer

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

func FromIndexView

func FromIndexView(view mongo.IndexView) *IndexViewer

func (*IndexViewer) Create

func (i *IndexViewer) Create(idx ...*model.Index) *IndexCreateBuilder

func (*IndexViewer) DropAll

func (i *IndexViewer) DropAll() *IndexDropBuilder

func (*IndexViewer) DropOne

func (i *IndexViewer) DropOne(name string) *IndexDropBuilder

func (*IndexViewer) List

func (i *IndexViewer) List() *IndexListBuilder

type TypedBuilder

type TypedBuilder[D bson.Doc[I], I bson.ID] struct {
	// contains filtered or unexported fields
}

func NewTypedBuilder

func NewTypedBuilder[D bson.Doc[I], I bson.ID](db *mongo.Database, name string) *TypedBuilder[D, I]

func (*TypedBuilder[D, I]) Build

func (b *TypedBuilder[D, I]) Build() *TypedCollection[D, I]

func (*TypedBuilder[D, I]) ReadConcern

func (b *TypedBuilder[D, I]) ReadConcern(rc *readconcern.ReadConcern) *TypedBuilder[D, I]

ReadConcern sets the value for the ReadConcern field.

func (*TypedBuilder[D, I]) ReadPreference

func (b *TypedBuilder[D, I]) ReadPreference(rp *readpref.ReadPref) *TypedBuilder[D, I]

ReadPreference sets the value for the ReadPreference field.

func (*TypedBuilder[D, I]) Registry

func (b *TypedBuilder[D, I]) Registry(r *bsoncodec.Registry) *TypedBuilder[D, I]

Registry sets the value for the Registry field.

func (*TypedBuilder[D, I]) WriteConcern

func (b *TypedBuilder[D, I]) WriteConcern(wc *writeconcern.WriteConcern) *TypedBuilder[D, I]

WriteConcern sets the value for the WriteConcern field.

type TypedCollection

type TypedCollection[D bson.Doc[I], I bson.ID] struct {
	// contains filtered or unexported fields
}

func NewTypedCollection

func NewTypedCollection[D bson.Doc[I], I bson.ID](primary, defaultReadpref *raw.Collection) *TypedCollection[D, I]

func (*TypedCollection[D, I]) Aggregate

func (c *TypedCollection[D, I]) Aggregate(pipe aggregate.Pipeline) *executor.AggregateExecutor[D, I]

func (*TypedCollection[D, I]) BulkWrite

func (c *TypedCollection[D, I]) BulkWrite() *executor.BulkWriteExecutor[D, I]

func (*TypedCollection[D, I]) CountDocuments

func (c *TypedCollection[D, I]) CountDocuments(filter *filters.Filter) *executor.CountExecutor[D, I]

func (*TypedCollection[D, I]) DeleteMany

func (c *TypedCollection[D, I]) DeleteMany(filter *filters.Filter) *executor.DeleteExecutor[D, I]

func (*TypedCollection[D, I]) DeleteOne

func (c *TypedCollection[D, I]) DeleteOne(filter *filters.Filter) *executor.DeleteExecutor[D, I]

func (*TypedCollection[D, I]) Distinct

func (c *TypedCollection[D, I]) Distinct(field string) *executor.DistinctExecutor

func (*TypedCollection[D, I]) Find

func (c *TypedCollection[D, I]) Find(filter *filters.Filter) *executor.FindExecutor[D, I]

func (*TypedCollection[D, I]) FindByIds

func (c *TypedCollection[D, I]) FindByIds(ids []I) *executor.FindExecutor[D, I]

func (*TypedCollection[D, I]) FindOne

func (c *TypedCollection[D, I]) FindOne(filter *filters.Filter) *executor.FindOneExecutor[D, I]

func (*TypedCollection[D, I]) FindOneAndUpdate

func (c *TypedCollection[D, I]) FindOneAndUpdate(filter *filters.Filter, update *update.Update) *executor.FindOneAndUpdateExecutor[D, I]

func (*TypedCollection[D, I]) FindOneById

func (c *TypedCollection[D, I]) FindOneById(id I) *executor.FindOneExecutor[D, I]

func (*TypedCollection[D, I]) Indexes

func (c *TypedCollection[D, I]) Indexes() *IndexViewer

func (*TypedCollection[D, I]) InsertMany

func (c *TypedCollection[D, I]) InsertMany(docs ...D) *executor.InsertManyExecutor[D, I]

func (*TypedCollection[D, I]) InsertOne

func (c *TypedCollection[D, I]) InsertOne(doc D) *executor.InsertOneExecutor[D, I]

func (*TypedCollection[D, I]) UpdateById

func (c *TypedCollection[D, I]) UpdateById(id I, update *update.Update) *executor.UpdateExecutor[D, I]

func (*TypedCollection[D, I]) UpdateMany

func (c *TypedCollection[D, I]) UpdateMany(filter *filters.Filter, update *update.Update) *executor.UpdateExecutor[D, I]

func (*TypedCollection[D, I]) UpdateOne

func (c *TypedCollection[D, I]) UpdateOne(filter *filters.Filter, update *update.Update) *executor.UpdateExecutor[D, I]

Jump to

Keyboard shortcuts

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