Documentation ¶
Index ¶
- func Aggregate(ctx context.Context, col string, query []bson.M, value interface{}) error
- func Count(ctx context.Context, col string) (int64, error)
- func CountWithFilter(ctx context.Context, col string, filter interface{}) (int64, error)
- func CountWithQuery(ctx context.Context, col string, query any) (int, error)
- func DeleteOne(ctx context.Context, col string, query bson.M) (mongo.DeleteResult, error)
- func FindOne(ctx context.Context, col string, query bson.M, value interface{}) error
- func GetMongoClient() *mongo.Client
- func GetMongoDb() *mongo.Database
- func Init(cp DatabaseCredentialHelper, host string, port string, database string)
- func InsertOne(ctx context.Context, col string, input interface{}) (mongo.InsertOneResult, error)
- func Ping() bool
- func UpdateOne(ctx context.Context, col string, filter bson.M, update bson.M) (mongo.UpdateResult, error)
- type DatabaseCredentialHelper
- type MongodbCon
- func (rc MongodbCon) Aggregate(ctx context.Context, col string, query []bson.M, value interface{}) error
- func (rc MongodbCon) CheckHealth() []health.Check
- func (rc MongodbCon) Count(ctx context.Context, col string) (int64, error)
- func (rc MongodbCon) CountWithFilter(ctx context.Context, col string, filter interface{}) (int64, error)
- func (rc MongodbCon) CountWithQuery(ctx context.Context, col string, query any) (int, error)
- func (rc MongodbCon) DeleteOne(ctx context.Context, col string, query bson.M) (mongo.DeleteResult, error)
- func (rc MongodbCon) FindOne(ctx context.Context, col string, query bson.M, value interface{}) error
- func (rc MongodbCon) GenerateAggregateQuery(rorResourceQuery *rorresources.ResourceQuery) []bson.M
- func (rc MongodbCon) GetMongoDb() *mongo.Database
- func (rc MongodbCon) InsertOne(ctx context.Context, col string, input interface{}) (mongo.InsertOneResult, error)
- func (rc MongodbCon) UpdateOne(ctx context.Context, col string, filter bson.M, update bson.M) (mongo.UpdateResult, error)
- func (rc MongodbCon) UpsertOne(ctx context.Context, col string, filter bson.M, update interface{}) (mongo.UpdateResult, error)
- type MongodbQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountWithFilter ¶
func GetMongoClient ¶ added in v0.0.13
func GetMongoDb ¶
GetMongoDb function returns a pointer to the `mongo.Database` instance used to communicate with MongoDB server. The function simply returns the MongoDB client instance stored in a `mongodb` singleton object. This function is used to obtain the MongoDB client connection in other parts of the application.
func Init ¶
func Init(cp DatabaseCredentialHelper, host string, port string, database string)
Initializes the mongodb client
Types ¶
type MongodbCon ¶ added in v0.3.0
type MongodbCon struct { Client *mongo.Client Context context.Context Credentials DatabaseCredentialHelper Host string Port string Database string }
This type implements the mongodb connection in ror
func GetMongodbConnection ¶ added in v0.3.0
func GetMongodbConnection() *MongodbCon
func (MongodbCon) CheckHealth ¶ added in v0.3.0
func (rc MongodbCon) CheckHealth() []health.Check
CheckHealth checks the health of the redis connection and returns a health check
func (MongodbCon) CountWithFilter ¶ added in v0.3.0
func (MongodbCon) CountWithQuery ¶ added in v0.3.0
func (MongodbCon) DeleteOne ¶ added in v0.3.0
func (rc MongodbCon) DeleteOne(ctx context.Context, col string, query bson.M) (mongo.DeleteResult, error)
func (MongodbCon) GenerateAggregateQuery ¶ added in v0.3.0
func (rc MongodbCon) GenerateAggregateQuery(rorResourceQuery *rorresources.ResourceQuery) []bson.M
func (MongodbCon) GetMongoDb ¶ added in v0.3.0
func (rc MongodbCon) GetMongoDb() *mongo.Database
func (MongodbCon) InsertOne ¶ added in v0.3.0
func (rc MongodbCon) InsertOne(ctx context.Context, col string, input interface{}) (mongo.InsertOneResult, error)
type MongodbQuery ¶ added in v1.0.0
func NewMongodbQuery ¶ added in v1.0.0
func NewMongodbQuery(input []bson.M) MongodbQuery
func (MongodbQuery) MongoshPrint ¶ added in v1.0.0
func (m MongodbQuery) MongoshPrint(collection string)
func (MongodbQuery) PrettyPrint ¶ added in v1.0.0
func (m MongodbQuery) PrettyPrint()
Click to show internal directories.
Click to hide internal directories.