restructure pkg and internal

This commit is contained in:
2025-03-28 12:33:42 +01:00
parent bb792b41e2
commit 40377416da
41 changed files with 1391 additions and 1387 deletions

View File

@@ -12,9 +12,10 @@ import (
"github.com/gin-contrib/cors"
ginzap "github.com/gin-contrib/zap"
"github.com/gin-gonic/gin"
"github.com/vcscsvcscs/GenerationsHeritage/apps/db-adapter/internal/api"
apiServer "github.com/vcscsvcscs/GenerationsHeritage/apps/db-adapter/internal/api"
"github.com/vcscsvcscs/GenerationsHeritage/apps/db-adapter/internal/memgraph"
"github.com/vcscsvcscs/GenerationsHeritage/apps/db-adapter/pkg/api"
"github.com/vcscsvcscs/GenerationsHeritage/apps/db-adapter/pkg/gin/healthcheck"
"github.com/vcscsvcscs/GenerationsHeritage/apps/db-adapter/pkg/memgraph"
"github.com/spf13/viper"
"go.uber.org/zap"
@@ -27,6 +28,7 @@ var (
memgraphPass string
production bool
requestTimeout time.Duration
dbOpTimeout time.Duration
)
func init() {
@@ -46,6 +48,7 @@ func init() {
memgraphPass = viper.GetString("MEMGRAPH_PASS")
production = viper.GetBool("PRODUCTION")
requestTimeout = time.Duration(viper.GetInt("REQUEST_TIMEOUT")) * time.Second
dbOpTimeout = time.Duration(viper.GetInt("DB_OP_TIMEOUT")) * time.Millisecond
}
func main() {
@@ -76,7 +79,7 @@ func main() {
router.Use(ginzap.Ginzap(logger, time.RFC3339, true))
router.Use(ginzap.RecoveryWithZap(logger, true))
sApi := api.New(logger, memgraphDriver, hc)
sApi := apiServer.New(logger, memgraphDriver, hc, dbOpTimeout)
api.RegisterHandlersWithOptions(router, sApi, api.GinServerOptions{})
server := &http.Server{