Skip to content

Commit

Permalink
style: 🎨 formating code
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdihadeli committed Aug 10, 2023
1 parent 68d12c1 commit af8e3a4
Show file tree
Hide file tree
Showing 127 changed files with 387 additions and 526 deletions.
3 changes: 1 addition & 2 deletions internal/pkg/bun/postgres/bun_postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import (
"github.com/uptrace/bun"
"github.com/uptrace/bun/dialect/pgdialect"
"github.com/uptrace/bun/driver/pgdriver"
_ "github.com/uptrace/bun/driver/pgdriver"

bun2 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/bun"
// loading bun's official Postgres driver.
_ "github.com/uptrace/bun/driver/pgdriver"
)

func NewBunDB(cfg *bun2.BunConfig) (*bun.DB, error) {
Expand Down
3 changes: 1 addition & 2 deletions internal/pkg/fxapp/application_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import (
"path/filepath"
"strings"

"go.uber.org/fx"

"github.com/spf13/viper"
"go.uber.org/fx"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/config/environemnt"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/constants"
Expand Down
1 change: 0 additions & 1 deletion internal/pkg/gorm_postgres/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

"emperror.dev/errors"
"github.com/uptrace/bun/driver/pgdriver"

gormPostgres "gorm.io/driver/postgres"
"gorm.io/gorm"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ import (
"log"
"testing"

customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors"

_ "github.com/lib/pq" // postgres driver
uuid "github.com/satori/go.uuid"
"github.com/stretchr/testify/assert"
"gorm.io/gorm"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/data"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/data/specification"
customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper"
gorm2 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/test/containers/testcontainer/gorm"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils"
Expand Down
8 changes: 3 additions & 5 deletions internal/pkg/grpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@ import (
"net"
"time"

"google.golang.org/grpc/health"
"google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/grpc/keepalive"

"emperror.dev/errors"

grpcMiddleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpcRecovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery"
grpcCtxTags "github.com/grpc-ecosystem/go-grpc-middleware/tags"
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
"go.opentelemetry.io/otel/metric"
googleGrpc "google.golang.org/grpc"
"google.golang.org/grpc/health"
"google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/grpc/keepalive"
"google.golang.org/grpc/reflection"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/grpc/config"
Expand Down
6 changes: 2 additions & 4 deletions internal/pkg/mongodb/mongodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ import (
"fmt"
"time"

"github.com/kamva/mgm/v3"
"go.mongodb.org/mongo-driver/mongo/options"

_ "github.com/golang-migrate/migrate/v4/source/file"

"github.com/kamva/mgm/v3"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
)

const (
Expand Down
7 changes: 2 additions & 5 deletions internal/pkg/mongodb/repository/mongo_generic_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@ import (
"context"
"fmt"

"github.com/goccy/go-reflect"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/data"

"emperror.dev/errors"

"github.com/goccy/go-reflect"
"github.com/iancoleman/strcase"
uuid "github.com/satori/go.uuid"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/data"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/data/specification"
customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
"log"
"testing"

mongo2 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/test/containers/testcontainer/mongo"

uuid "github.com/satori/go.uuid"
"github.com/stretchr/testify/assert"
"go.mongodb.org/mongo-driver/mongo"
Expand All @@ -16,6 +14,7 @@ import (
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/data/specification"
customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper"
mongo2 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/test/containers/testcontainer/mongo"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import (
)

// https://github.com/testcontainers/testcontainers-go/issues/1359
//https://github.com/testcontainers/testcontainers-go/issues/1249

// https://github.com/testcontainers/testcontainers-go/issues/1249
type gormTestContainers struct {
container testcontainers.Container
defaultOptions *contracts.PostgresContainerOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import (
)

// https://github.com/testcontainers/testcontainers-go/issues/1359
//https://github.com/testcontainers/testcontainers-go/issues/1249

// https://github.com/testcontainers/testcontainers-go/issues/1249
type postgresPgxTestContainers struct {
container testcontainers.Container
defaultOptions *contracts.PostgresContainerOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package mediator

import (
"emperror.dev/errors"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing"
"github.com/mehdihadeli/go-mediatr"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/data"
Expand All @@ -15,9 +17,6 @@ import (
searchProductsDtosV1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/features/searching_products/v1/dtos"
searchProductsQueryV1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/features/searching_products/v1/queries"
updateProductCommandV1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/features/updating_products/v1/commands"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing"
)

func ConfigProductsMediator(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package configurations

import (
"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/configurations/mappings"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/configurations/mediator"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/data"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/fxapp/contracts"
logger2 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/web/route"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/configurations/mappings"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/configurations/mediator"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/data"
)

type ProductsModuleConfigurator struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package rabbitmq

import (
"github.com/go-playground/validator"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/messaging/consumer"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ package params
import (
"github.com/go-playground/validator"
"github.com/labstack/echo/v4"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger"
"go.uber.org/fx"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/shared/contracts"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger"
)

type ProductRouteParams struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,19 @@ import (
"fmt"

"emperror.dev/errors"
uuid2 "github.com/satori/go.uuid"
"go.mongodb.org/mongo-driver/mongo"
attribute2 "go.opentelemetry.io/otel/attribute"

data2 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/data"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/models"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/data"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mongodb"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mongodb/repository"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing/attribute"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils"
uuid2 "github.com/satori/go.uuid"
"go.mongodb.org/mongo-driver/mongo"
attribute2 "go.opentelemetry.io/otel/attribute"

data2 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/data"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/models"
)

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ import (

"emperror.dev/errors"
"github.com/go-redis/redis/v8"
attribute2 "go.opentelemetry.io/otel/attribute"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/data"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing/attribute"
attribute2 "go.opentelemetry.io/otel/attribute"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/data"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/models"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package commands
import (
"time"

uuid "github.com/satori/go.uuid"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils/validator"
uuid "github.com/satori/go.uuid"
)

type CreateProduct struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ import (
"context"
"fmt"

attribute2 "go.opentelemetry.io/otel/attribute"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/data"

customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing/attribute"
attribute2 "go.opentelemetry.io/otel/attribute"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/data"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/features/creating_product/v1/dtos"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/models"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ import (

"emperror.dev/errors"
"github.com/go-playground/validator"
"github.com/mehdihadeli/go-mediatr"

customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/messaging/consumer"
messageTracing "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/messaging/otel/tracing"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/messaging/types"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing/attribute"
"github.com/mehdihadeli/go-mediatr"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/features/creating_product/v1/commands"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/features/creating_product/v1/dtos"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import (
"context"
"fmt"

"github.com/mehdihadeli/go-mediatr"
attribute2 "go.opentelemetry.io/otel/attribute"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/data"

customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing/attribute"
"github.com/mehdihadeli/go-mediatr"
attribute2 "go.opentelemetry.io/otel/attribute"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/data"
)

type DeleteProductCommand struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ import (

"emperror.dev/errors"
"github.com/go-playground/validator"
"github.com/mehdihadeli/go-mediatr"
uuid "github.com/satori/go.uuid"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/features/deleting_products/v1/commands"

customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/messaging/consumer"
messageTracing "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/messaging/otel/tracing"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/messaging/types"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing/attribute"
"github.com/mehdihadeli/go-mediatr"
uuid "github.com/satori/go.uuid"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/features/deleting_products/v1/commands"
)

type productDeletedConsumer struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ import (

"emperror.dev/errors"
"github.com/labstack/echo/v4"
customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/web/route"
"github.com/mehdihadeli/go-mediatr"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/params"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/features/get_product_by_id/v1/dtos"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/features/get_product_by_id/v1/queries"

customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/web/route"
)

type getProductByIdEndpoint struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@ import (
"context"
"fmt"

attribute2 "go.opentelemetry.io/otel/attribute"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/data"

customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing/attribute"
attribute2 "go.opentelemetry.io/otel/attribute"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/data"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/dto"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/features/get_product_by_id/v1/dtos"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/models"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ import (

"emperror.dev/errors"
"github.com/labstack/echo/v4"
"github.com/mehdihadeli/go-mediatr"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/params"

customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/web/route"
"github.com/mehdihadeli/go-mediatr"

"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/params"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/features/getting_products/v1/dtos"
"github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/features/getting_products/v1/queries"
)
Expand Down
Loading

0 comments on commit af8e3a4

Please sign in to comment.