model

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateGroup added in v0.0.4

type AggregateGroup bson.M

func NewAggregateGroup added in v0.0.7

func NewAggregateGroup() AggregateGroup

func (AggregateGroup) Field added in v0.0.6

func (a AggregateGroup) Field(field, from string) AggregateGroup

func (AggregateGroup) SumFixed added in v0.0.6

func (a AggregateGroup) SumFixed(field string, value int) AggregateGroup

type AggregatePage added in v0.0.4

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

type AggregatePipeline added in v0.0.4

type AggregatePipeline mongo.Pipeline

func NewAggregatePipeline added in v0.0.5

func NewAggregatePipeline() AggregatePipeline

func (AggregatePipeline) Group added in v0.0.4

func (AggregatePipeline) Match added in v0.0.4

func (a AggregatePipeline) Match(filter Filter) AggregatePipeline

func (AggregatePipeline) Page added in v0.0.4

type Filter

type Filter bson.M

func NewFilter

func NewFilter() Filter

func TypedFilter

func TypedFilter(raw bson.M) Filter

func (Filter) Eq

func (f Filter) Eq(field string, value interface{}) Filter

func (Filter) IgnoreCaseRegex added in v0.0.4

func (f Filter) IgnoreCaseRegex(field string, pattern string)

func (Filter) In

func (f Filter) In(field string, value []interface{}) Filter

func (Filter) Nin

func (f Filter) Nin(field string, value []interface{}) Filter

func (Filter) Or

func (f Filter) Or(conditions bson.A) Filter

func (Filter) Regex added in v0.0.4

func (f Filter) Regex(field string, pattern string)

type FindOneAndUpdate

type FindOneAndUpdate struct {
	Filter Filter
	Update Update
}

func NewFindOneAndUpdate added in v0.0.4

func NewFindOneAndUpdate() *FindOneAndUpdate

func (*FindOneAndUpdate) SetFilter added in v0.0.4

func (m *FindOneAndUpdate) SetFilter(filter Filter) *FindOneAndUpdate

func (*FindOneAndUpdate) SetUpdate added in v0.0.4

func (m *FindOneAndUpdate) SetUpdate(update Update) *FindOneAndUpdate

type TypedUpdateOneModel added in v0.0.10

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

func NewTypeUpdateOneModel added in v0.0.10

func NewTypeUpdateOneModel() *TypedUpdateOneModel

func (*TypedUpdateOneModel) SetArrayFilters added in v0.0.10

func (uom *TypedUpdateOneModel) SetArrayFilters(filters options.ArrayFilters) *TypedUpdateOneModel

SetArrayFilters specifies a set of filters to determine which elements should be modified when updating an array field.

func (*TypedUpdateOneModel) SetCollation added in v0.0.10

func (uom *TypedUpdateOneModel) SetCollation(collation *options.Collation) *TypedUpdateOneModel

SetCollation specifies a collation to use for string comparisons. The default is nil, meaning no collation will be used.

func (*TypedUpdateOneModel) SetFilter added in v0.0.10

func (uom *TypedUpdateOneModel) SetFilter(filter Filter) *TypedUpdateOneModel

SetFilter specifies a filter to use to select the document to update. The filter must be a document containing query operators. It cannot be nil. If the filter matches multiple documents, one will be selected from the matching documents.

func (*TypedUpdateOneModel) SetHint added in v0.0.10

func (uom *TypedUpdateOneModel) SetHint(hint interface{}) *TypedUpdateOneModel

SetHint specifies the index to use for the operation. This should either be the index name as a string or the index specification as a document. This option is only valid for MongoDB versions >= 4.2. Server versions >= 3.4 will return an error if this option is specified. For server versions < 3.4, the driver will return a client-side error if this option is specified. The driver will return an error if this option is specified during an unacknowledged write operation. The driver will return an error if the hint parameter is a multi-key map. The default value is nil, which means that no hint will be sent.

func (*TypedUpdateOneModel) SetUpdate added in v0.0.10

func (uom *TypedUpdateOneModel) SetUpdate(update Update) *TypedUpdateOneModel

SetUpdate specifies the modifications to be made to the selected document. The value must be a document containing update operators (https://docs.mongodb.com/manual/reference/operator/update/). It cannot be nil or empty.

func (*TypedUpdateOneModel) SetUpsert added in v0.0.10

func (uom *TypedUpdateOneModel) SetUpsert(upsert bool) *TypedUpdateOneModel

SetUpsert specifies whether or not a new document should be inserted if no document matching the filter is found. If an upsert is performed, the _id of the upserted document can be retrieved from the UpsertedIDs field of the BulkWriteResult.

func (*TypedUpdateOneModel) WriteModel added in v0.0.10

func (uom *TypedUpdateOneModel) WriteModel() mongo.WriteModel

type Update

type Update bson.M

func (Update) Set

func (u Update) Set(update bson.M) Update

func (Update) SetOnInsert

func (u Update) SetOnInsert(update bson.M) Update

type UpdateById

type UpdateById struct {
	Id     primitive.ObjectID
	Update Update
}

type UpdateMany

type UpdateMany struct {
	Filter Filter
	Update Update
}

func NewUpdateMany added in v0.0.9

func NewUpdateMany() *UpdateMany

func (*UpdateMany) SetFilter added in v0.0.9

func (m *UpdateMany) SetFilter(filter Filter) *UpdateMany

func (*UpdateMany) SetUpdate added in v0.0.9

func (m *UpdateMany) SetUpdate(update Update) *UpdateMany

Jump to

Keyboard shortcuts

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