services/references/usecase/storage/mongo/repository.go
Method repository.buildQueryPipeline
has 84 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (r *repository) buildQueryPipeline(matchQuery bson.M, param *meta.RequestParams) mongo.Pipeline {
pipe := mongo.Pipeline{}
pipe = append(pipe, bson.D{{"$match", matchQuery}})
pipe = append(pipe, bson.D{
Method repository.FetchQuery
has 5 return statements (exceeds 4 allowed). Open
Open
func (r *repository) FetchQuery(query meta.RequestQuery, params *meta.RequestParams) ([]*model.SneakerReference, error) {
ctx, cancel := context.WithTimeout(context.Background(), r.timeout)
defer cancel()
filter, err := query.ToBson(); if err != nil {
Method repository.FetchOne
has 5 return statements (exceeds 4 allowed). Open
Open
func (r *repository) FetchOne(code string, params *meta.RequestParams) (*model.SneakerReference, error) {
ctx, cancel := context.WithTimeout(context.Background(), r.timeout)
defer cancel()
query := r.buildQueryPipeline(bson.M{"uniqueid": code}, params)
Method repository.Fetch
has 5 return statements (exceeds 4 allowed). Open
Open
func (r *repository) Fetch(codes []string, params *meta.RequestParams) ([]*model.SneakerReference, error) {
ctx, cancel := context.WithTimeout(context.Background(), r.timeout)
defer cancel()
query := r.buildQueryPipeline(bson.M{"uniqueid": bson.M{"$in": codes}}, params)