Update MongoDB Driver and Configuration for Company Entities
- Updated the MongoDB driver from v1.17.4 to v2.3.0, ensuring compatibility with the latest features and improvements. - Refactored company-related entity and repository files to utilize the new driver, replacing `primitive.ObjectID` with `bson.ObjectID` for ID handling. - Adjusted the configuration in `.drone.yml` to include the `main` branch in the trigger settings, enhancing CI/CD pipeline flexibility.
This commit is contained in:
@@ -8,8 +8,7 @@ import (
|
||||
orm "tm/pkg/mongo"
|
||||
"tm/pkg/response"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
|
||||
// Repository defines the interface for category data operations
|
||||
@@ -99,9 +98,9 @@ func (r *categoryRepository) GetByID(ctx context.Context, id string) (*Category,
|
||||
|
||||
// GetByIDs retrieves categories by IDs
|
||||
func (r *categoryRepository) GetByIDs(ctx context.Context, ids []string) ([]Category, error) {
|
||||
objectIDs := make([]primitive.ObjectID, len(ids))
|
||||
objectIDs := make([]bson.ObjectID, len(ids))
|
||||
for i, id := range ids {
|
||||
objectID, err := primitive.ObjectIDFromHex(id)
|
||||
objectID, err := bson.ObjectIDFromHex(id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user