mongo

package
v0.0.0-...-ac40b45 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const MaxPageDocumentsLimit = int64(10000)

MaxPageDocumentsLimit max number of records that will be returned as a result of find query

Variables

View Source
var Timeout time.Duration

Timeout mongo connection timeout

Functions

func GetCollection

func GetCollection(collectionName string) *mongo.Collection

GetCollection returns Mongo db collection with the given collection name

func GetCount

func GetCount(ctx context.Context, collection *mongo.Collection, match bson.M) (int64, error)

GetCount returns count of query result

func GetFindOneResult

func GetFindOneResult(ctx context.Context, coll *mongo.Collection, match bson.M) *mongo.SingleResult

GetFindOneResult no sort, skip, limit, just match

func GetFindOnlyMatchResults

func GetFindOnlyMatchResults(ctx context.Context, coll *mongo.Collection, match bson.M) (*mongo.Cursor, error)

GetFindOnlyMatchResults no sort, skip, limit, just match

func GetFindQueryResults

func GetFindQueryResults(ctx context.Context, coll *mongo.Collection, match bson.M, sort bson.D, skip int64, length int64) (*mongo.Cursor, error)

GetFindQueryResults returns cursor of find query results

func InitializeMongo

func InitializeMongo(envFile string, mongoConnTimeout int)

InitializeMongo setup MongoDB connection environments

func Insert

func Insert(ctx context.Context, collection *mongo.Collection, data interface{}) error

Insert returns count of query result

func SearchQueryForSearchBuilderRequest

func SearchQueryForSearchBuilderRequest(req *models.SearchBuilderRequest) bson.M

SearchQueryForSearchBuilderRequest creates search query for datasets

func SortQueryBuilder

func SortQueryBuilder(r *models.DataTableRequest, uniqueSortColumn string) bson.D

SortQueryBuilder creates sort object which support multiple column sort

Types

This section is empty.

Jump to

Keyboard shortcuts

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