Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package main

import (
"golang-rest-api-template/config"
_ "golang-rest-api-template/internal/handlers/category/model"
"golang-rest-api-template/package/logger"
"github.com/MitulShah1/golang-rest-api-template/package/logger"

_ "github.com/MitulShah1/golang-rest-api-template/internal/handlers/category/model"

"github.com/MitulShah1/golang-rest-api-template/config"
)

// @title REST API Template Example
Expand Down
7 changes: 4 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ package config

import (
"context"
"golang-rest-api-template/internal/handlers"
"golang-rest-api-template/package/database"
"golang-rest-api-template/package/logger"
"net/http"
"os"
"os/signal"
"syscall"
"time"

"github.com/MitulShah1/golang-rest-api-template/internal/handlers"
"github.com/MitulShah1/golang-rest-api-template/package/database"
"github.com/MitulShah1/golang-rest-api-template/package/logger"

"github.com/joho/godotenv"
)

Expand Down
94 changes: 47 additions & 47 deletions docs/docs.go

Large diffs are not rendered by default.

94 changes: 47 additions & 47 deletions docs/swagger.json

Large diffs are not rendered by default.

94 changes: 47 additions & 47 deletions docs/swagger.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module golang-rest-api-template
module github.com/MitulShah1/golang-rest-api-template

go 1.21.0

Expand Down
9 changes: 5 additions & 4 deletions internal/handlers/category/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package category

import (
"encoding/json"
"golang-rest-api-template/internal/handlers/product/model"
"golang-rest-api-template/internal/response"
"golang-rest-api-template/internal/services/category"
"golang-rest-api-template/package/logger"
"net/http"

"github.com/MitulShah1/golang-rest-api-template/internal/handlers/product/model"
"github.com/MitulShah1/golang-rest-api-template/internal/response"
"github.com/MitulShah1/golang-rest-api-template/internal/services/category"
"github.com/MitulShah1/golang-rest-api-template/package/logger"

"github.com/gorilla/mux"
)

Expand Down
7 changes: 4 additions & 3 deletions internal/handlers/category/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package category

import (
"encoding/json"
"golang-rest-api-template/internal/handlers/category/model"
"golang-rest-api-template/internal/response"
"golang-rest-api-template/package/validation"
"io"
"net/http"

"github.com/MitulShah1/golang-rest-api-template/internal/handlers/category/model"
"github.com/MitulShah1/golang-rest-api-template/internal/response"
"github.com/MitulShah1/golang-rest-api-template/package/validation"
)

// Category godoc
Expand Down
6 changes: 3 additions & 3 deletions internal/handlers/category/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"net/http/httptest"
"testing"

"golang-rest-api-template/internal/handlers/category/model"
"golang-rest-api-template/internal/services/category/mocks"
"golang-rest-api-template/package/logger"
"github.com/MitulShah1/golang-rest-api-template/internal/handlers/category/model"
"github.com/MitulShah1/golang-rest-api-template/internal/services/category/mocks"
"github.com/MitulShah1/golang-rest-api-template/package/logger"

"github.com/stretchr/testify/assert"
)
Expand Down
5 changes: 3 additions & 2 deletions internal/handlers/category/delete.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package category

import (
"golang-rest-api-template/internal/handlers/category/model"
"golang-rest-api-template/internal/response"
"net/http"
"strconv"

"github.com/MitulShah1/golang-rest-api-template/internal/handlers/category/model"
"github.com/MitulShah1/golang-rest-api-template/internal/response"

"github.com/gorilla/mux"
)

Expand Down
6 changes: 3 additions & 3 deletions internal/handlers/category/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"net/http/httptest"
"testing"

"golang-rest-api-template/internal/handlers/category/model"
sqlModel "golang-rest-api-template/internal/repository/model"
"golang-rest-api-template/package/logger"
"github.com/MitulShah1/golang-rest-api-template/internal/handlers/category/model"
sqlModel "github.com/MitulShah1/golang-rest-api-template/internal/repository/model"
"github.com/MitulShah1/golang-rest-api-template/package/logger"

"github.com/gorilla/mux"
"github.com/stretchr/testify/assert"
Expand Down
5 changes: 3 additions & 2 deletions internal/handlers/category/details.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package category

import (
"encoding/json"
"golang-rest-api-template/internal/handlers/category/model"
"golang-rest-api-template/internal/response"
"net/http"
"strconv"

"github.com/MitulShah1/golang-rest-api-template/internal/handlers/category/model"
"github.com/MitulShah1/golang-rest-api-template/internal/response"

"github.com/gorilla/mux"
)

Expand Down
6 changes: 3 additions & 3 deletions internal/handlers/category/details_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"net/http/httptest"
"testing"

"golang-rest-api-template/internal/handlers/category/model"
sqlModel "golang-rest-api-template/internal/repository/model"
"golang-rest-api-template/package/logger"
"github.com/MitulShah1/golang-rest-api-template/internal/handlers/category/model"
sqlModel "github.com/MitulShah1/golang-rest-api-template/internal/repository/model"
"github.com/MitulShah1/golang-rest-api-template/package/logger"

"github.com/gorilla/mux"
"github.com/stretchr/testify/assert"
Expand Down
7 changes: 4 additions & 3 deletions internal/handlers/category/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package category

import (
"encoding/json"
"golang-rest-api-template/internal/handlers/category/model"
"golang-rest-api-template/internal/response"
"golang-rest-api-template/package/validation"
"io"
"net/http"
"strconv"

"github.com/MitulShah1/golang-rest-api-template/internal/handlers/category/model"
"github.com/MitulShah1/golang-rest-api-template/internal/response"
"github.com/MitulShah1/golang-rest-api-template/package/validation"

"github.com/gorilla/mux"
)

Expand Down
4 changes: 2 additions & 2 deletions internal/handlers/category/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"net/http/httptest"
"testing"

"golang-rest-api-template/internal/handlers/category/model"
"golang-rest-api-template/package/logger"
"github.com/MitulShah1/golang-rest-api-template/internal/handlers/category/model"
"github.com/MitulShah1/golang-rest-api-template/package/logger"

"github.com/gorilla/mux"
"github.com/stretchr/testify/assert"
Expand Down
5 changes: 3 additions & 2 deletions internal/handlers/health/api.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package health

import (
"golang-rest-api-template/internal/response"
"golang-rest-api-template/package/logger"
"net/http"

"github.com/MitulShah1/golang-rest-api-template/internal/response"
"github.com/MitulShah1/golang-rest-api-template/package/logger"

"github.com/gorilla/mux"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/handlers/health/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package health
import (
"testing"

"golang-rest-api-template/package/logger"
"github.com/MitulShah1/golang-rest-api-template/package/logger"

"github.com/stretchr/testify/assert"
)
Expand Down
9 changes: 5 additions & 4 deletions internal/handlers/product/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package product

import (
"encoding/json"
"golang-rest-api-template/internal/handlers/product/model"
"golang-rest-api-template/internal/response"
"golang-rest-api-template/internal/services/product"
"golang-rest-api-template/package/logger"
"net/http"

"github.com/MitulShah1/golang-rest-api-template/internal/handlers/product/model"
"github.com/MitulShah1/golang-rest-api-template/internal/response"
"github.com/MitulShah1/golang-rest-api-template/internal/services/product"
"github.com/MitulShah1/golang-rest-api-template/package/logger"

"github.com/gorilla/mux"
)

Expand Down
7 changes: 4 additions & 3 deletions internal/handlers/product/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package product

import (
"encoding/json"
"golang-rest-api-template/internal/handlers/product/model"
"golang-rest-api-template/internal/response"
"golang-rest-api-template/package/validation"
"io"
"net/http"

"github.com/MitulShah1/golang-rest-api-template/internal/handlers/product/model"
"github.com/MitulShah1/golang-rest-api-template/internal/response"
"github.com/MitulShah1/golang-rest-api-template/package/validation"
)

// Product godoc
Expand Down
6 changes: 3 additions & 3 deletions internal/handlers/product/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"net/http/httptest"
"testing"

"golang-rest-api-template/internal/handlers/product/model"
"golang-rest-api-template/internal/services/product/mocks"
"golang-rest-api-template/package/logger"
"github.com/MitulShah1/golang-rest-api-template/internal/handlers/product/model"
"github.com/MitulShah1/golang-rest-api-template/internal/services/product/mocks"
"github.com/MitulShah1/golang-rest-api-template/package/logger"

"github.com/stretchr/testify/assert"
)
Expand Down
5 changes: 3 additions & 2 deletions internal/handlers/product/delete.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package product

import (
"golang-rest-api-template/internal/handlers/product/model"
"golang-rest-api-template/internal/response"
"net/http"
"strconv"

"github.com/MitulShah1/golang-rest-api-template/internal/handlers/product/model"
"github.com/MitulShah1/golang-rest-api-template/internal/response"

"github.com/gorilla/mux"
)

Expand Down
4 changes: 2 additions & 2 deletions internal/handlers/product/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"net/http/httptest"
"testing"

"golang-rest-api-template/internal/handlers/product/model"
"golang-rest-api-template/package/logger"
"github.com/MitulShah1/golang-rest-api-template/internal/handlers/product/model"
"github.com/MitulShah1/golang-rest-api-template/package/logger"

"github.com/gorilla/mux"
"github.com/stretchr/testify/assert"
Expand Down
5 changes: 3 additions & 2 deletions internal/handlers/product/details.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package product

import (
"encoding/json"
"golang-rest-api-template/internal/handlers/product/model"
"golang-rest-api-template/internal/response"
"net/http"
"strconv"

"github.com/MitulShah1/golang-rest-api-template/internal/handlers/product/model"
"github.com/MitulShah1/golang-rest-api-template/internal/response"

"github.com/gorilla/mux"
)

Expand Down
4 changes: 2 additions & 2 deletions internal/handlers/product/details_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"net/http/httptest"
"testing"

"golang-rest-api-template/internal/handlers/product/model"
"golang-rest-api-template/package/logger"
"github.com/MitulShah1/golang-rest-api-template/internal/handlers/product/model"
"github.com/MitulShah1/golang-rest-api-template/package/logger"

"github.com/gorilla/mux"
"github.com/stretchr/testify/assert"
Expand Down
7 changes: 4 additions & 3 deletions internal/handlers/product/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package product

import (
"encoding/json"
"golang-rest-api-template/internal/handlers/product/model"
"golang-rest-api-template/internal/response"
"golang-rest-api-template/package/validation"
"io"
"net/http"
"strconv"

"github.com/MitulShah1/golang-rest-api-template/internal/handlers/product/model"
"github.com/MitulShah1/golang-rest-api-template/internal/response"
"github.com/MitulShah1/golang-rest-api-template/package/validation"

"github.com/gorilla/mux"
)

Expand Down
4 changes: 2 additions & 2 deletions internal/handlers/product/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"net/http/httptest"
"testing"

"golang-rest-api-template/internal/handlers/product/model"
"golang-rest-api-template/package/logger"
"github.com/MitulShah1/golang-rest-api-template/internal/handlers/product/model"
"github.com/MitulShah1/golang-rest-api-template/package/logger"

"github.com/gorilla/mux"
"github.com/stretchr/testify/assert"
Expand Down
21 changes: 11 additions & 10 deletions internal/handlers/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@ package handlers

import (
"context"
"golang-rest-api-template/internal/handlers/health"
prodApi "golang-rest-api-template/internal/handlers/product"
"golang-rest-api-template/internal/repository"
"golang-rest-api-template/internal/services/category"
"golang-rest-api-template/internal/services/product"
"golang-rest-api-template/package/database"
"golang-rest-api-template/package/logger"
"golang-rest-api-template/package/middleware"
"net"
"net/http"

_ "golang-rest-api-template/docs"
catApi "golang-rest-api-template/internal/handlers/category"
"github.com/MitulShah1/golang-rest-api-template/internal/handlers/health"
prodApi "github.com/MitulShah1/golang-rest-api-template/internal/handlers/product"
"github.com/MitulShah1/golang-rest-api-template/internal/repository"
"github.com/MitulShah1/golang-rest-api-template/internal/services/category"
"github.com/MitulShah1/golang-rest-api-template/internal/services/product"
"github.com/MitulShah1/golang-rest-api-template/package/database"
"github.com/MitulShah1/golang-rest-api-template/package/logger"
"github.com/MitulShah1/golang-rest-api-template/package/middleware"

_ "github.com/MitulShah1/golang-rest-api-template/docs"
catApi "github.com/MitulShah1/golang-rest-api-template/internal/handlers/category"

"github.com/gorilla/mux"
httpSwagger "github.com/swaggo/http-swagger/v2"
Expand Down
3 changes: 2 additions & 1 deletion internal/repository/category_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package repository
import (
"context"
"database/sql"
"golang-rest-api-template/internal/repository/model"

"github.com/MitulShah1/golang-rest-api-template/internal/repository/model"

"github.com/Masterminds/squirrel"
)
Expand Down
6 changes: 3 additions & 3 deletions internal/repository/category_repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"testing"
"time"

"golang-rest-api-template/internal/repository/model"
"golang-rest-api-template/package/database"
"golang-rest-api-template/package/database/mocks"
"github.com/MitulShah1/golang-rest-api-template/internal/repository/model"
"github.com/MitulShah1/golang-rest-api-template/package/database"
"github.com/MitulShah1/golang-rest-api-template/package/database/mocks"

"github.com/DATA-DOG/go-sqlmock"
"github.com/stretchr/testify/assert"
Expand Down
3 changes: 2 additions & 1 deletion internal/repository/product_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import (
"context"
"database/sql"
"fmt"
"golang-rest-api-template/internal/repository/model"

"github.com/MitulShah1/golang-rest-api-template/internal/repository/model"

"github.com/Masterminds/squirrel"
)
Expand Down
Loading