Documentation ¶
Index ¶
- type AfterOpContext
- type AfterOpContextOption
- type Finder
- func (f *Finder[T]) Count(ctx context.Context, opts ...*options.CountOptions) (int64, error)
- func (f *Finder[T]) Distinct(ctx context.Context, fieldName string, opts ...*options.DistinctOptions) ([]any, error)
- func (f *Finder[T]) DistinctWithParse(ctx context.Context, fieldName string, result any, ...) error
- func (f *Finder[T]) Filter(filter any) *Finder[T]
- func (f *Finder[T]) Find(ctx context.Context, opts ...*options.FindOptions) ([]*T, error)
- func (f *Finder[T]) FindOne(ctx context.Context, opts ...*options.FindOneOptions) (*T, error)
- func (f *Finder[T]) RegisterAfterHooks(hooks ...afterHookFn[T]) *Finder[T]
- func (f *Finder[T]) RegisterBeforeHooks(hooks ...beforeHookFn) *Finder[T]
- type OpContext
- type OpContextOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AfterOpContext ¶ added in v0.12.0
func NewAfterOpContext ¶ added in v0.12.0
func NewAfterOpContext[T any](opContext *OpContext, opts ...AfterOpContextOption[T]) *AfterOpContext[T]
type AfterOpContextOption ¶ added in v0.12.0
type AfterOpContextOption[T any] func(*AfterOpContext[T])
func WithDoc ¶ added in v0.12.0
func WithDoc[T any](doc *T) AfterOpContextOption[T]
func WithDocs ¶ added in v0.12.0
func WithDocs[T any](docs []*T) AfterOpContextOption[T]
type Finder ¶
type Finder[T any] struct { // contains filtered or unexported fields }
func (*Finder[T]) DistinctWithParse ¶ added in v0.11.0
func (f *Finder[T]) DistinctWithParse(ctx context.Context, fieldName string, result any, opts ...*options.DistinctOptions) error
DistinctWithParse is used to parse the result of Distinct result must be a pointer
func (*Finder[T]) RegisterAfterHooks ¶ added in v0.12.0
RegisterAfterHooks is used to set the after hooks of the query If you register the hook for FindOne, the opContext.Docs will be nil If you register the hook for Find, the opContext.Doc will be nil
func (*Finder[T]) RegisterBeforeHooks ¶ added in v0.12.0
type OpContext ¶ added in v0.12.0
type OpContext struct { Col *mongo.Collection `opt:"-"` Filter any `opt:"-"` }
func NewOpContext ¶ added in v0.12.0
func NewOpContext(col *mongo.Collection, filter any, opts ...OpContextOption) *OpContext
type OpContextOption ¶ added in v0.12.0
type OpContextOption func(*OpContext)
Click to show internal directories.
Click to hide internal directories.