Documentation ¶
Index ¶
- func HandleEquals(pipeline *[]bson.M, fieldName string, fieldValue interface{})
- func HandleGreaterThan(pipeline *[]bson.M, fieldName string, fieldValue interface{})
- func HandleGreaterThanEquals(pipeline *[]bson.M, fieldName string, fieldValue interface{})
- func HandleLessThan(pipeline *[]bson.M, fieldName string, fieldValue interface{})
- func HandleLessThanEquals(pipeline *[]bson.M, fieldName string, fieldValue interface{})
- func HandleNotEquals(pipeline *[]bson.M, fieldName string, fieldValue interface{})
- type DBClient
- type EmployeeDetails
- type MockMongoClient
- type MockMongoClientStruct
- type Mongo
- type Queries
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleEquals ¶
Parse the == into equivalent mongo query.
func HandleGreaterThan ¶
Parse the > into equivalent mongo query.
func HandleGreaterThanEquals ¶
Parse the >= into equivalent mongo query.
func HandleLessThan ¶
Parse the < into equivalent mongo query.
func HandleLessThanEquals ¶
Parse the <= into equivalent mongo query.
func HandleNotEquals ¶
Parse the != into equivalent mongo query.
Types ¶
type DBClient ¶
type DBClient interface { QueryMongo(pipeline []Queries) (Result, error) GetAllDataFromMongo() []EmployeeDetails }
type EmployeeDetails ¶
type MockMongoClient ¶
type MockMongoClient interface { QueryMongo(pipeline []Queries) (Result, error) GetAllDataFromMongo() []EmployeeDetails }
func NewMockMongoClient ¶
func NewMockMongoClient(mongo *mongo.Client, database string) MockMongoClient
type MockMongoClientStruct ¶
type MockMongoClientStruct struct { Mongo *mongo.Client Database string ClientOptions *options.ClientOptions Logger *zap.Logger }
func (*MockMongoClientStruct) GetAllDataFromMongo ¶
func (c *MockMongoClientStruct) GetAllDataFromMongo() []EmployeeDetails
func (*MockMongoClientStruct) QueryMongo ¶
func (c *MockMongoClientStruct) QueryMongo(pipeline []Queries) (Result, error)
type Mongo ¶
type Mongo struct { Mongo *mongo.Client Database string ClientOptions *options.ClientOptions Logger *zap.Logger }
func (*Mongo) CreateConnection ¶
Create a connection with mongo DB.
func (*Mongo) CreateTestData ¶
func (c *Mongo) CreateTestData()
func (*Mongo) GetAllDataFromMongo ¶
func (c *Mongo) GetAllDataFromMongo() []EmployeeDetails
Fetches all the employees data from mongo DB.
type Result ¶
type Result struct { Defined bool Data []EmployeeDetails }
Result contains output of partially evaluating a query.
Click to show internal directories.
Click to hide internal directories.