Documentation ¶
Index ¶
- Constants
- Variables
- func GetCollection(collectionName string) *mongo.Collection
- func GetCount(ctx context.Context, collection *mongo.Collection, match bson.M) (int64, error)
- func GetFindOneResult(ctx context.Context, coll *mongo.Collection, match bson.M) *mongo.SingleResult
- func GetFindOnlyMatchResults(ctx context.Context, coll *mongo.Collection, match bson.M) (*mongo.Cursor, error)
- func GetFindQueryResults(ctx context.Context, coll *mongo.Collection, match bson.M, sort bson.D, ...) (*mongo.Cursor, error)
- func InitializeMongo(envFile string, mongoConnTimeout int)
- func Insert(ctx context.Context, collection *mongo.Collection, data interface{}) error
- func SearchQueryForSearchBuilderRequest(req *models.SearchBuilderRequest) bson.M
- func SortQueryBuilder(r *models.DataTableRequest, uniqueSortColumn string) bson.D
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 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 ¶
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.
Click to show internal directories.
Click to hide internal directories.