Documentation ¶
Index ¶
- type FindOneOptions
- type FindOptions
- type HookOptions
- type InsertManyOptions
- type InsertOneOptions
- type PopulateOption
- type PopulateOptions
- func (pop *PopulateOptions) SetCollection(coll string) *PopulateOptions
- func (pop *PopulateOptions) SetForeignField(foreignField string) *PopulateOptions
- func (pop *PopulateOptions) SetLocalField(localField string) *PopulateOptions
- func (pop *PopulateOptions) SetMatch(match bson.M) *PopulateOptions
- func (pop *PopulateOptions) SetOnlyOne(onlyOne bool) *PopulateOptions
- func (pop *PopulateOptions) SetOptions(options *options.FindOptions) *PopulateOptions
- func (pop *PopulateOptions) SetPath(path string) *PopulateOptions
- func (pop *PopulateOptions) SetPopulate(populate ...*PopulateOptions) *PopulateOptions
- func (pop *PopulateOptions) SetSchema(schema interface{}) *PopulateOptions
- type QueryOptions
- func MergeFindOneOptions(opts ...*FindOneOptions) (*QueryOptions, *options.FindOneOptions)
- func MergeFindOptions(opts ...*FindOptions) (*QueryOptions, *options.FindOptions)
- func MergeInsertManyOptions(opts ...*InsertManyOptions) (*QueryOptions, *options.InsertManyOptions)
- func MergeInsertOneOptions(opts ...*InsertOneOptions) (*QueryOptions, *options.InsertOneOptions)
- func MergeQueryOptions(opts ...*QueryOptions) *QueryOptions
- func Query() *QueryOptions
- type UpdateOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FindOneOptions ¶
type FindOneOptions struct { *options.FindOneOptions *QueryOptions *HookOptions }
FindOneOptions represents options that can be used to configure a FindOne operation.
type FindOptions ¶
type FindOptions struct { *options.FindOptions *QueryOptions *HookOptions }
FindOptions represents options that can be used to configure a Find operation.
type HookOptions ¶
type HookOptions struct { // DisableAllHooks disables all hooks, ignoring other hook options. DisableAllHooks *bool // DisableBeforeHooks disables all before hooks. DisableBeforeHooks *bool // DisableAfterHooks disables all after hooks. DisableAfterHooks *bool // This stores the names of the hooks that are disabled. // Example: []string{"BeforeCreate", "AfterCreate"} DisabledHooks *[]string }
HookOptions represents the options for configuring how hook runs on a single operation.
func (*HookOptions) SetDisableAfterHooks ¶
func (opts *HookOptions) SetDisableAfterHooks(disable bool) *HookOptions
SetDisableAfterHooks sets the `DisableAfterHooks` option.
func (*HookOptions) SetDisableAllHooks ¶
func (opts *HookOptions) SetDisableAllHooks(disable bool) *HookOptions
SetDisableAllHooks sets the `DisableAllHooks` option.
func (*HookOptions) SetDisableBeforeHooks ¶
func (opts *HookOptions) SetDisableBeforeHooks(disable bool) *HookOptions
SetDisableBeforeHooks sets the `DisableBeforeHooks` option.
func (*HookOptions) SetDisabledHooks ¶
func (opts *HookOptions) SetDisabledHooks(hooks ...string) *HookOptions
SetDisabledHooks sets the `DisabledHooks` option.
type InsertManyOptions ¶
type InsertManyOptions struct { *options.InsertManyOptions *HookOptions }
InsertManyOptions represents the options for inserting many document.
type InsertOneOptions ¶
type InsertOneOptions struct { *options.InsertOneOptions *HookOptions }
InsertOneOptions represents the options for inserting a document.
type PopulateOption ¶
type PopulateOption = []*PopulateOptions
type PopulateOptions ¶
type PopulateOptions struct { // Path to populate. Path *string // Optional query conditions to match. Match *bson.M // Model to use for population. Collection *string // Optional query options. Only sort, skip, limit and projections are used. Options *options.FindOptions // Paths to populate on the populated doc. Populate *[]*PopulateOptions // Schema the populated doc is associated with, default is bson.M. Schema interface{} // Override the schema-level `LocalField` option for this individual `populate()` call. LocalField *string // Override the schema-level `ForeignField` option for this individual `populate()` call. // Default: "_id" ForeignField *string // If true `path` is to a document, or `nil` if no document was found. // If false `path` is set to an array, which will be empty if no documents are found. // Default: true OnlyOne *bool }
PopulateOptions represents the options for populating a path on a document.
func Populate ¶
func Populate() *PopulateOptions
Populate returns a new PopulateOptions with `OnlyOne` set to `true`.
func (*PopulateOptions) SetCollection ¶
func (pop *PopulateOptions) SetCollection(coll string) *PopulateOptions
SetCollection sets the `Collection` option.
func (*PopulateOptions) SetForeignField ¶
func (pop *PopulateOptions) SetForeignField(foreignField string) *PopulateOptions
SetForeignField sets the `ForeignField` option.
func (*PopulateOptions) SetLocalField ¶
func (pop *PopulateOptions) SetLocalField(localField string) *PopulateOptions
SetLocalField sets the `LocalField` option.
func (*PopulateOptions) SetMatch ¶
func (pop *PopulateOptions) SetMatch(match bson.M) *PopulateOptions
SetMatch sets the `Match` option.
func (*PopulateOptions) SetOnlyOne ¶
func (pop *PopulateOptions) SetOnlyOne(onlyOne bool) *PopulateOptions
SetOnlyOne sets the `OnlyOne` option.
func (*PopulateOptions) SetOptions ¶
func (pop *PopulateOptions) SetOptions(options *options.FindOptions) *PopulateOptions
SetOptions sets the `Options` option.
func (*PopulateOptions) SetPath ¶
func (pop *PopulateOptions) SetPath(path string) *PopulateOptions
SetPath sets the `Path` option.
func (*PopulateOptions) SetPopulate ¶
func (pop *PopulateOptions) SetPopulate(populate ...*PopulateOptions) *PopulateOptions
SetPopulate sets the `Populate` option.
func (*PopulateOptions) SetSchema ¶
func (pop *PopulateOptions) SetSchema(schema interface{}) *PopulateOptions
SetSchema sets the `Schema` option.
type QueryOptions ¶
type QueryOptions struct {
*PopulateOption
}
QueryOptions represents the options for querying documents.
func MergeFindOneOptions ¶
func MergeFindOneOptions(opts ...*FindOneOptions) (*QueryOptions, *options.FindOneOptions)
MergeFindOneOptions combines the given FindOneOptions instances into a single FindOneOptions in a last-one-wins fashion. Deprecated: Use single struct options.
func MergeFindOptions ¶
func MergeFindOptions(opts ...*FindOptions) (*QueryOptions, *options.FindOptions)
MergeFindOptions combines the given FindOptions instances into a single FindOptions in a last-one-wins fashion. Deprecated: Use single struct options.
func MergeInsertManyOptions ¶
func MergeInsertManyOptions( opts ...*InsertManyOptions, ) (*QueryOptions, *options.InsertManyOptions)
MergeInsertManyOptions combines the given InsertManyOptions instances into a single InsertManyOptions in a last-one-wins fashion. Deprecated: Use single struct options.
func MergeInsertOneOptions ¶
func MergeInsertOneOptions(opts ...*InsertOneOptions) (*QueryOptions, *options.InsertOneOptions)
MergeInsertOneOptions combines the given InsertOneOptions instances into a single InsertOneOptions in a last-one-wins fashion. Deprecated: Use single struct options.
func MergeQueryOptions ¶
func MergeQueryOptions(opts ...*QueryOptions) *QueryOptions
func (*QueryOptions) SetPopulate ¶
func (qo *QueryOptions) SetPopulate(populate ...*PopulateOptions) *QueryOptions
SetPopulate sets the `Populate` option.
type UpdateOptions ¶
type UpdateOptions struct { *options.UpdateOptions *HookOptions }