Documentation
¶
Index ¶
- type Aggregator
- func (a *Aggregator[T]) Aggregate(ctx context.Context, opts ...options.Lister[options.AggregateOptions]) ([]*T, error)
- func (a *Aggregator[T]) AggregateWithParse(ctx context.Context, result any, ...) error
- func (a *Aggregator[T]) ModelHook(modelHook any) *Aggregator[T]
- func (a *Aggregator[T]) Pipeline(pipeline any) *Aggregator[T]
- func (a *Aggregator[T]) RegisterAfterHooks(hooks ...afterHookFn) *Aggregator[T]
- func (a *Aggregator[T]) RegisterBeforeHooks(hooks ...beforeHookFn) *Aggregator[T]
- type IAggregator
- type OpContext
- type OpContextOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregator ¶
type Aggregator[T any] struct { // contains filtered or unexported fields }
func NewAggregator ¶
func NewAggregator[T any](collection *mongo.Collection, dbCallbacks *callback.Callback, fields []*field.Filed) *Aggregator[T]
func (*Aggregator[T]) Aggregate ¶
func (a *Aggregator[T]) Aggregate(ctx context.Context, opts ...options.Lister[options.AggregateOptions]) ([]*T, error)
func (*Aggregator[T]) AggregateWithParse ¶
func (a *Aggregator[T]) AggregateWithParse(ctx context.Context, result any, opts ...options.Lister[options.AggregateOptions]) error
AggregateWithParse is used to parse the result of the aggregation result must be a pointer to a slice
func (*Aggregator[T]) ModelHook ¶ added in v2.2.0
func (a *Aggregator[T]) ModelHook(modelHook any) *Aggregator[T]
func (*Aggregator[T]) Pipeline ¶
func (a *Aggregator[T]) Pipeline(pipeline any) *Aggregator[T]
func (*Aggregator[T]) RegisterAfterHooks ¶ added in v2.2.0
func (a *Aggregator[T]) RegisterAfterHooks(hooks ...afterHookFn) *Aggregator[T]
func (*Aggregator[T]) RegisterBeforeHooks ¶ added in v2.2.0
func (a *Aggregator[T]) RegisterBeforeHooks(hooks ...beforeHookFn) *Aggregator[T]
type IAggregator ¶
type OpContext ¶ added in v2.2.0
type OpContext struct { Col *mongo.Collection `opt:"-"` Pipeline any `opt:"-"` Fields []*field.Filed MongoOptions any ModelHook any StartTime time.Time Result any }
func NewOpContext ¶ added in v2.2.0
func NewOpContext(col *mongo.Collection, pipeline any, opts ...OpContextOption) *OpContext
type OpContextOption ¶ added in v2.2.0
type OpContextOption func(*OpContext)
func WithFields ¶ added in v2.2.0
func WithFields(fields []*field.Filed) OpContextOption
func WithModelHook ¶ added in v2.2.0
func WithModelHook(modelHook any) OpContextOption
func WithMongoOptions ¶ added in v2.2.0
func WithMongoOptions(mongoOptions any) OpContextOption
func WithResult ¶ added in v2.2.0
func WithResult(result any) OpContextOption
func WithStartTime ¶ added in v2.2.0
func WithStartTime(startTime time.Time) OpContextOption
Click to show internal directories.
Click to hide internal directories.