operators

package
v0.0.0-...-cae665e Latest Latest
Warning

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

Go to latest
Published: May 17, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AggregateCount

func AggregateCount(
	coll *mongo.Collection,
	ctx context.Context,
	pipeline bson.A,
	restOpts ...*options.CountOptions) (int64, error)

AggregateCount takes a pipeline and count the results

func AggregateGetIndexById

func AggregateGetIndexById(coll *mongo.Collection, ctx context.Context, pipeline bson.A, id interface{}) (int64, error)

GetIndexById Obtain the index from collection using id as referece

func FindById

func FindById(coll *mongo.Collection, ctx context.Context, id interface{}) (*mongo.SingleResult, error)

func FindOne

func FindOne(coll *mongo.Collection, ctx context.Context, args *map[string]interface{}, opts ...*options.FindOneOptions) (*mongo.SingleResult, error)

func GetCount

func GetCount(coll *mongo.Collection, ctx context.Context) (int64, error)

func GetIndexById

func GetIndexById(coll *mongo.Collection, ctx context.Context, id interface{}) (int64, error)

GetIndexById Obtain the index from collection using id as referece

func Sync

func Sync(coll *mongo.Collection, ctx context.Context, mixed interface{}) error

Types

type AggregateSliceMetadata

type AggregateSliceMetadata struct {
	Total      int64 `json:"total"`
	SliceCount int64 `json:"sliceCount"`
	SliceStart int64 `json:"sliceStart"`
}

FindSliceMetadata

func (*AggregateSliceMetadata) GetSliceCount

func (meta *AggregateSliceMetadata) GetSliceCount() int64

func (*AggregateSliceMetadata) GetSliceStart

func (meta *AggregateSliceMetadata) GetSliceStart() int64

func (*AggregateSliceMetadata) GetTotal

func (meta *AggregateSliceMetadata) GetTotal() int64

type FindSliceMetadata

type FindSliceMetadata struct {
	Total      int `json:"total"`
	SliceCount int `json:"sliceCount"`
	SliceStart int `json:"sliceStart"`
}

FindSliceMetadata

func FindSlice

func FindSlice(coll *mongo.Collection, ctx context.Context, args *map[string]interface{}) ([]bson.Raw, *FindSliceMetadata, error)

type SliceMetadata

type SliceMetadata interface {
	GetTotal() int64
	GetSliceCount() int64
	GetSliceStart() int64
}

func AggregateSlice

func AggregateSlice(
	coll *mongo.Collection,
	ctx context.Context,
	pipeline bson.A,
) (
	result []bson.Raw,
	meta SliceMetadata,
	err error,
)

Jump to

Keyboard shortcuts

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