From eaccbd34e41bca5d0d84208d812365144ed85887 Mon Sep 17 00:00:00 2001 From: ivamp Date: Sat, 23 Nov 2024 01:55:15 +0800 Subject: [PATCH] update --- cmd/document.go | 2 +- cmd/migrate.go | 2 +- cmd/schedule.go | 2 +- cmd/wire.go | 24 +++++------ cmd/wire_gen.go | 40 +++++++++---------- go.mod | 2 +- hack/gorm-gen/gorm.go | 2 +- hack/rename/rename.go | 2 +- internal/base/app.go | 21 +++++----- internal/base/conf/helper.go | 2 +- internal/base/conf/provider.go | 2 +- internal/base/orm/provide.go | 5 ++- internal/base/redis/provide.go | 2 +- internal/base/s3/provide.go | 2 +- internal/base/server/echo.go | 10 ++--- internal/batch/provider.go | 2 +- internal/dao/users.gen.go | 2 +- internal/entity/Model.go | 2 +- internal/handler/grpc/documents/document.go | 2 +- internal/handler/grpc/documents/provider.go | 4 +- internal/handler/grpc/interceptor/auth.go | 6 +-- .../handler/grpc/interceptor/zap_logger.go | 2 +- internal/handler/grpc/provider.go | 4 +- internal/handler/handler.go | 4 +- internal/handler/http/controller/v1/test.go | 6 +-- internal/handler/http/middleware/auth.go | 10 ++--- internal/handler/http/provider.go | 10 ++--- internal/migrations/init.go | 2 +- internal/router/api.go | 2 +- internal/router/swagger.go | 2 +- internal/service/auth/auth.go | 10 ++--- internal/service/jwks/jwks.go | 4 +- internal/service/provider.go | 8 ++-- internal/service/stream/producer.go | 2 +- internal/service/stream/provider.go | 2 +- main.go | 2 +- pkg/consts/auth.go | 2 +- pkg/consts/rbac.go | 2 +- 38 files changed, 107 insertions(+), 105 deletions(-) diff --git a/cmd/document.go b/cmd/document.go index d22f2bd..6f99b1b 100644 --- a/cmd/document.go +++ b/cmd/document.go @@ -4,9 +4,9 @@ import ( "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/auth" "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/logging" "github.com/spf13/cobra" - "go-template/pkg/protos/documentService" "google.golang.org/grpc" "google.golang.org/grpc/reflection" + "leaf "net" ) diff --git a/cmd/migrate.go b/cmd/migrate.go index 8691c22..f806da0 100644 --- a/cmd/migrate.go +++ b/cmd/migrate.go @@ -3,7 +3,7 @@ package cmd import ( "context" "fmt" - "go-template/internal/migrations" + "leafdev.top/Leaf/api-platform/internal/migrations" "os" "strings" "time" diff --git a/cmd/schedule.go b/cmd/schedule.go index 01f0589..075b86d 100644 --- a/cmd/schedule.go +++ b/cmd/schedule.go @@ -1,7 +1,7 @@ package cmd import ( - "go-template/internal/base" + "leafdev.top/Leaf/api-platform/internal/base" "github.com/spf13/cobra" ) diff --git a/cmd/wire.go b/cmd/wire.go index 1c8bb87..6dd00c1 100644 --- a/cmd/wire.go +++ b/cmd/wire.go @@ -4,18 +4,18 @@ package cmd import ( - "go-template/internal/base" - "go-template/internal/base/conf" - "go-template/internal/base/logger" - "go-template/internal/base/orm" - "go-template/internal/base/redis" - "go-template/internal/base/s3" - "go-template/internal/base/server" - "go-template/internal/batch" - "go-template/internal/dao" - "go-template/internal/handler" - "go-template/internal/router" - "go-template/internal/service" + "leafdev.top/Leaf/api-platform/internal/base" + "leafdev.top/Leaf/api-platform/internal/base/conf" + "leafdev.top/Leaf/api-platform/internal/base/logger" + "leafdev.top/Leaf/api-platform/internal/base/orm" + "leafdev.top/Leaf/api-platform/internal/base/redis" + "leafdev.top/Leaf/api-platform/internal/base/s3" + "leafdev.top/Leaf/api-platform/internal/base/server" + "leafdev.top/Leaf/api-platform/internal/batch" + "leafdev.top/Leaf/api-platform/internal/dao" + "leafdev.top/Leaf/api-platform/internal/handler" + "leafdev.top/Leaf/api-platform/internal/router" + "leafdev.top/Leaf/api-platform/internal/service" "github.com/google/wire" ) diff --git a/cmd/wire_gen.go b/cmd/wire_gen.go index e085681..b4ac32b 100644 --- a/cmd/wire_gen.go +++ b/cmd/wire_gen.go @@ -8,26 +8,26 @@ package cmd import ( "github.com/google/wire" - "go-template/internal/base" - "go-template/internal/base/conf" - "go-template/internal/base/logger" - "go-template/internal/base/orm" - "go-template/internal/base/redis" - "go-template/internal/base/s3" - "go-template/internal/base/server" - "go-template/internal/batch" - "go-template/internal/dao" - "go-template/internal/handler" - "go-template/internal/handler/grpc" - "go-template/internal/handler/grpc/documents" - "go-template/internal/handler/grpc/interceptor" - "go-template/internal/handler/http" - "go-template/internal/handler/http/controller/v1" - "go-template/internal/router" - "go-template/internal/service" - "go-template/internal/service/auth" - "go-template/internal/service/jwks" - "go-template/internal/service/stream" + "leafdev.top/Leaf/api-platform/internal/base" + "leafdev.top/Leaf/api-platform/internal/base/conf" + "leafdev.top/Leaf/api-platform/internal/base/logger" + "leafdev.top/Leaf/api-platform/internal/base/orm" + "leafdev.top/Leaf/api-platform/internal/base/redis" + "leafdev.top/Leaf/api-platform/internal/base/s3" + "leafdev.top/Leaf/api-platform/internal/base/server" + "leafdev.top/Leaf/api-platform/internal/batch" + "leafdev.top/Leaf/api-platform/internal/dao" + "leafdev.top/Leaf/api-platform/internal/handler" + "leafdev.top/Leaf/api-platform/internal/handler/grpc" + "leafdev.top/Leaf/api-platform/internal/handler/grpc/documents" + "leafdev.top/Leaf/api-platform/internal/handler/grpc/interceptor" + "leafdev.top/Leaf/api-platform/internal/handler/http" + "leafdev.top/Leaf/api-platform/internal/handler/http/controller/v1" + "leafdev.top/Leaf/api-platform/internal/router" + "leafdev.top/Leaf/api-platform/internal/service" + "leafdev.top/Leaf/api-platform/internal/service/auth" + "leafdev.top/Leaf/api-platform/internal/service/jwks" + "leafdev.top/Leaf/api-platform/internal/service/stream" ) // Injectors from wire.go: diff --git a/go.mod b/go.mod index 99cafc5..52eb5a8 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module go-template +module leafdev.top/Leaf/api-platform go 1.23.2 diff --git a/hack/gorm-gen/gorm.go b/hack/gorm-gen/gorm.go index 18498b0..6f4191d 100644 --- a/hack/gorm-gen/gorm.go +++ b/hack/gorm-gen/gorm.go @@ -1,7 +1,7 @@ package main import ( - "go-template/internal/entity" + "leafdev.top/Leaf/api-platform/internal/entity" "gorm.io/gen" ) diff --git a/hack/rename/rename.go b/hack/rename/rename.go index 9cf213f..a3a4a34 100644 --- a/hack/rename/rename.go +++ b/hack/rename/rename.go @@ -10,7 +10,7 @@ import ( "strings" ) -const frameworkModuleName = "leafdev.top/ecosystem/billing" +const frameworkModuleName = "leafdev.top/Leaf/api-platform" func main() { // 输入新的 go.mod module diff --git a/internal/base/app.go b/internal/base/app.go index b350b43..3db6c44 100644 --- a/internal/base/app.go +++ b/internal/base/app.go @@ -1,16 +1,17 @@ package base import ( - "go-template/internal/base/conf" - "go-template/internal/base/logger" - "go-template/internal/base/redis" - "go-template/internal/base/s3" - "go-template/internal/base/server" - "go-template/internal/batch" - "go-template/internal/dao" - "go-template/internal/handler" - "go-template/internal/handler/http" - "go-template/internal/service" + "gorm.io/gorm" + "leafdev.top/Leaf/api-platform/int + "leafdev.top/Leaf/api-platform/internal/base/conf" + "leafdev.top/Leaf/api-platform/internal/base/logger" + "leafdev.top/Leaf/api-platform/internal/base/redis" + "leafdev.top/Leaf/api-platform/internal/base/s3" + "leafdev.top/Leaf/api-platform/internal/base/server" + "leafdev.top/Leaf/api-platform/internal/batch" + "leafdev.top/Leaf/api-platform/internal/dao" + "leafdev.top/Leaf/api-platform/internal/handler" + "leafdev.top/Leaf/api-platform/internal/handler/http" "gorm.io/gorm" ) diff --git a/internal/base/conf/helper.go b/internal/base/conf/helper.go index 877d87e..7c02ba6 100644 --- a/internal/base/conf/helper.go +++ b/internal/base/conf/helper.go @@ -1,7 +1,7 @@ package conf import ( - "go-template/configs" + "leafdev.top/Leaf/api-platform/configs" "os" ) diff --git a/internal/base/conf/provider.go b/internal/base/conf/provider.go index 2874511..b0c5968 100644 --- a/internal/base/conf/provider.go +++ b/internal/base/conf/provider.go @@ -1,7 +1,7 @@ package conf import ( - "go-template/internal/base/logger" + "leafdev.top/Leaf/api-platform/internal/base/logger" "os" "path/filepath" "strings" diff --git a/internal/base/orm/provide.go b/internal/base/orm/provide.go index f159869..2baeb7a 100644 --- a/internal/base/orm/provide.go +++ b/internal/base/orm/provide.go @@ -2,8 +2,9 @@ package orm import ( "fmt" - "go-template/internal/base/conf" - "go-template/internal/base/logger" + "gorm.io/driver/postgres" + "leafdev.top/Leaf/api-p + "leafdev.top/Leaf/api-platform/internal/base/conf" "gorm.io/driver/postgres" "gorm.io/gorm" diff --git a/internal/base/redis/provide.go b/internal/base/redis/provide.go index 516f5bd..21d07cf 100644 --- a/internal/base/redis/provide.go +++ b/internal/base/redis/provide.go @@ -3,7 +3,7 @@ package redis import ( "context" "fmt" - "go-template/internal/base/conf" + "leafdev.top/Leaf/api-platform/internal/base/conf" "github.com/bsm/redislock" "github.com/redis/go-redis/v9" diff --git a/internal/base/s3/provide.go b/internal/base/s3/provide.go index 91a5a8b..a380418 100644 --- a/internal/base/s3/provide.go +++ b/internal/base/s3/provide.go @@ -1,7 +1,7 @@ package s3 import ( - "go-template/internal/base/conf" + "leafdev.top/Leaf/api-platform/internal/base/conf" "github.com/minio/minio-go/v7" "github.com/minio/minio-go/v7/pkg/credentials" diff --git a/internal/base/server/echo.go b/internal/base/server/echo.go index 086844c..ed5e294 100644 --- a/internal/base/server/echo.go +++ b/internal/base/server/echo.go @@ -4,11 +4,11 @@ import ( "github.com/labstack/echo-contrib/echoprometheus" "github.com/labstack/echo/v4" echoMiddleware "github.com/labstack/echo/v4/middleware" - "go-template/internal/base/conf" - httpHandlers "go-template/internal/handler/http" - "go-template/internal/handler/http/response" - "go-template/internal/router" - "go-template/pkg/consts" + "leafdev.top/Leaf/api-platform/internal/base/conf" + httpHandlers "leafdev.top/Leaf/api-platform/internal/handler/http" + "leafdev.top/Leaf/api-platform/internal/handler/http/response" + "leafdev.top/Leaf/api-platform/internal/router" + "leafdev.top/Leaf/api-platform/pkg/consts" "net/http" ) diff --git a/internal/batch/provider.go b/internal/batch/provider.go index 4525cb5..a75d13c 100644 --- a/internal/batch/provider.go +++ b/internal/batch/provider.go @@ -1,7 +1,7 @@ package batch import ( - "go-template/internal/base/logger" + "leafdev.top/Leaf/api-platform/internal/base/logger" ) type Batch struct { diff --git a/internal/dao/users.gen.go b/internal/dao/users.gen.go index 342b46c..32cb89d 100644 --- a/internal/dao/users.gen.go +++ b/internal/dao/users.gen.go @@ -16,7 +16,7 @@ import ( "gorm.io/plugin/dbresolver" - "go-template/internal/entity" + "leafdev.top/Leaf/api-platform/internal/entity" ) func newUser(db *gorm.DB, opts ...gen.DOOption) user { diff --git a/internal/entity/Model.go b/internal/entity/Model.go index aa89f82..1bf33ff 100644 --- a/internal/entity/Model.go +++ b/internal/entity/Model.go @@ -1,7 +1,7 @@ package entity import ( - "go-template/internal/schema" + "leafdev.top/Leaf/api-platform/internal/schema" "time" ) diff --git a/internal/handler/grpc/documents/document.go b/internal/handler/grpc/documents/document.go index ddf32c7..ab69261 100644 --- a/internal/handler/grpc/documents/document.go +++ b/internal/handler/grpc/documents/document.go @@ -2,7 +2,7 @@ package documents import ( "context" - "go-template/pkg/protos/documentService" + "leafdev.top/Leaf/api-platform/pkg/protos/documentService" ) func (d *DocumentService) ListDocuments(ctx context.Context, req *documentService.ListDocumentsRequest) (*documentService.ListDocumentsResponse, error) { diff --git a/internal/handler/grpc/documents/provider.go b/internal/handler/grpc/documents/provider.go index 3b020b6..6279c86 100644 --- a/internal/handler/grpc/documents/provider.go +++ b/internal/handler/grpc/documents/provider.go @@ -1,8 +1,8 @@ package documents import ( - "go-template/internal/dao" - "go-template/pkg/protos/documentService" + "leafdev.top/Leaf/api-platform/internal/dao" + "leafdev.top/Leaf/api-platform/pkg/protos/documentService" ) type DocumentService struct { diff --git a/internal/handler/grpc/interceptor/auth.go b/internal/handler/grpc/interceptor/auth.go index bb3d407..3823d71 100644 --- a/internal/handler/grpc/interceptor/auth.go +++ b/internal/handler/grpc/interceptor/auth.go @@ -4,9 +4,9 @@ import ( "context" "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/auth" "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/logging" - "go-template/internal/schema" - auth2 "go-template/internal/service/auth" - "go-template/pkg/consts" + "leafdev.top/Leaf/api-platform/internal/schema" + auth2 "leafdev.top/Leaf/api-platform/internal/service/auth" + "leafdev.top/Leaf/api-platform/pkg/consts" ) type Auth struct { diff --git a/internal/handler/grpc/interceptor/zap_logger.go b/internal/handler/grpc/interceptor/zap_logger.go index 93add19..4fbc70b 100644 --- a/internal/handler/grpc/interceptor/zap_logger.go +++ b/internal/handler/grpc/interceptor/zap_logger.go @@ -4,8 +4,8 @@ import ( "context" "fmt" "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/logging" - "go-template/internal/base/logger" "go.uber.org/zap" + "leafdev.top/Leaf/api-platform/internal/base/logger" ) type Logger struct { diff --git a/internal/handler/grpc/provider.go b/internal/handler/grpc/provider.go index ddd1b6a..78535b8 100644 --- a/internal/handler/grpc/provider.go +++ b/internal/handler/grpc/provider.go @@ -2,8 +2,8 @@ package grpc import ( "github.com/google/wire" - "go-template/internal/handler/grpc/documents" - "go-template/internal/handler/grpc/interceptor" + "leafdev.top/Leaf/api-platform/internal/handler/grpc/documents" + "leafdev.top/Leaf/api-platform/internal/handler/grpc/interceptor" ) var ProviderSet = wire.NewSet( diff --git a/internal/handler/handler.go b/internal/handler/handler.go index a87250a..ad5dce4 100644 --- a/internal/handler/handler.go +++ b/internal/handler/handler.go @@ -2,8 +2,8 @@ package handler import ( "github.com/google/wire" - "go-template/internal/handler/grpc" - "go-template/internal/handler/http" + "leafdev.top/Leaf/api-platform/internal/handler/grpc" + "leafdev.top/Leaf/api-platform/internal/handler/http" ) var ProviderSet = wire.NewSet( diff --git a/internal/handler/http/controller/v1/test.go b/internal/handler/http/controller/v1/test.go index 96782f3..5e6d26e 100644 --- a/internal/handler/http/controller/v1/test.go +++ b/internal/handler/http/controller/v1/test.go @@ -2,9 +2,9 @@ package v1 import ( "github.com/labstack/echo/v4" - "go-template/internal/handler/http/response" - "go-template/internal/schema" - "go-template/internal/service/auth" + "leafdev.top/Leaf/api-platform/internal/handler/http/response" + "leafdev.top/Leaf/api-platform/internal/schema" + "leafdev.top/Leaf/api-platform/internal/service/auth" "net/http" ) diff --git a/internal/handler/http/middleware/auth.go b/internal/handler/http/middleware/auth.go index 10a63be..67c5571 100644 --- a/internal/handler/http/middleware/auth.go +++ b/internal/handler/http/middleware/auth.go @@ -2,11 +2,11 @@ package middleware import ( "github.com/labstack/echo/v4" - "go-template/internal/base/conf" - "go-template/internal/handler/http/response" - "go-template/internal/schema" - "go-template/internal/service/auth" - "go-template/pkg/consts" + "leafdev.top/Leaf/api-platform/internal/base/conf" + "leafdev.top/Leaf/api-platform/internal/handler/http/response" + "leafdev.top/Leaf/api-platform/internal/schema" + "leafdev.top/Leaf/api-platform/internal/service/auth" + "leafdev.top/Leaf/api-platform/pkg/consts" "net/http" "slices" "strings" diff --git a/internal/handler/http/provider.go b/internal/handler/http/provider.go index f625793..7b30079 100644 --- a/internal/handler/http/provider.go +++ b/internal/handler/http/provider.go @@ -3,11 +3,11 @@ package http import ( "github.com/google/wire" "github.com/labstack/echo/v4" - "go-template/internal/base/conf" - "go-template/internal/base/logger" - v1 "go-template/internal/handler/http/controller/v1" - "go-template/internal/handler/http/middleware" - "go-template/internal/service/auth" + "leafdev.top/Leaf/api-platform/internal/base/conf" + "leafdev.top/Leaf/api-platform/internal/base/logger" + v1 "leafdev.top/Leaf/api-platform/internal/handler/http/controller/v1" + "leafdev.top/Leaf/api-platform/internal/handler/http/middleware" + "leafdev.top/Leaf/api-platform/internal/service/auth" ) type IMiddleware interface { diff --git a/internal/migrations/init.go b/internal/migrations/init.go index 1a0d72e..66bdb72 100644 --- a/internal/migrations/init.go +++ b/internal/migrations/init.go @@ -2,7 +2,7 @@ package migrations import ( "embed" - "go-template/internal/base/conf" + "leafdev.top/Leaf/api-platform/internal/base/conf" ) //go:embed *.sql diff --git a/internal/router/api.go b/internal/router/api.go index 6bcbf65..1087ea2 100644 --- a/internal/router/api.go +++ b/internal/router/api.go @@ -2,7 +2,7 @@ package router import ( "github.com/labstack/echo/v4" - "go-template/internal/handler/http" + "leafdev.top/Leaf/api-platform/internal/handler/http" ) // 两种方法都可以 diff --git a/internal/router/swagger.go b/internal/router/swagger.go index 3c54de1..f38dd69 100644 --- a/internal/router/swagger.go +++ b/internal/router/swagger.go @@ -2,7 +2,7 @@ package router import ( "github.com/labstack/echo/v4" - _ "go-template/docs" + _ "leafdev.top/Leaf/api-platform/docs" echoSwagger "github.com/swaggo/echo-swagger" ) diff --git a/internal/service/auth/auth.go b/internal/service/auth/auth.go index 947769e..d3cd074 100644 --- a/internal/service/auth/auth.go +++ b/internal/service/auth/auth.go @@ -4,11 +4,11 @@ import ( "context" "github.com/labstack/echo/v4" "github.com/mitchellh/mapstructure" - "go-template/internal/base/conf" - "go-template/internal/base/logger" - "go-template/internal/schema" - "go-template/internal/service/jwks" - "go-template/pkg/consts" + "leafdev.top/Leaf/api-platform/internal/base/conf" + "leafdev.top/Leaf/api-platform/internal/base/logger" + "leafdev.top/Leaf/api-platform/internal/schema" + "leafdev.top/Leaf/api-platform/internal/service/jwks" + "leafdev.top/Leaf/api-platform/pkg/consts" ) type Service struct { diff --git a/internal/service/jwks/jwks.go b/internal/service/jwks/jwks.go index eccf791..23126d4 100644 --- a/internal/service/jwks/jwks.go +++ b/internal/service/jwks/jwks.go @@ -2,8 +2,8 @@ package jwks import ( "errors" - "go-template/internal/base/conf" - "go-template/internal/base/logger" + "leafdev.top/Leaf/api-platform/internal/base/conf" + "leafdev.top/Leaf/api-platform/internal/base/logger" "github.com/MicahParks/keyfunc/v3" "github.com/golang-jwt/jwt/v5" diff --git a/internal/service/provider.go b/internal/service/provider.go index 4a9e225..0995459 100644 --- a/internal/service/provider.go +++ b/internal/service/provider.go @@ -1,10 +1,10 @@ package service import ( - "go-template/internal/base/logger" - "go-template/internal/service/auth" - "go-template/internal/service/jwks" - "go-template/internal/service/stream" + "leafdev.top/Leaf/api-platform/internal/base/logger" + "leafdev.top/Leaf/api-platform/internal/service/auth" + "leafdev.top/Leaf/api-platform/internal/service/jwks" + "leafdev.top/Leaf/api-platform/internal/service/stream" "github.com/google/wire" ) diff --git a/internal/service/stream/producer.go b/internal/service/stream/producer.go index e5ca44f..cc7cbc1 100644 --- a/internal/service/stream/producer.go +++ b/internal/service/stream/producer.go @@ -3,7 +3,7 @@ package stream import ( "context" "github.com/segmentio/kafka-go" - "go-template/internal/schema" + "leafdev.top/Leaf/api-platform/internal/schema" "time" ) diff --git a/internal/service/stream/provider.go b/internal/service/stream/provider.go index 37ece3f..26ca07c 100644 --- a/internal/service/stream/provider.go +++ b/internal/service/stream/provider.go @@ -1,7 +1,7 @@ package stream import ( - "go-template/internal/base/conf" + "leafdev.top/Leaf/api-platform/internal/base/conf" ) type Service struct { diff --git a/main.go b/main.go index 757ee12..6c54ca6 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,7 @@ package main import ( - "go-template/cmd" + "leafdev.top/Leaf/api-platform/cmd" ) // @title API Docs diff --git a/pkg/consts/auth.go b/pkg/consts/auth.go index 37bce18..37de94d 100644 --- a/pkg/consts/auth.go +++ b/pkg/consts/auth.go @@ -2,7 +2,7 @@ package consts import ( "errors" - "go-template/internal/schema" + "leafdev.top/Leaf/api-platform/internal/schema" ) const ( diff --git a/pkg/consts/rbac.go b/pkg/consts/rbac.go index 259daae..1de9b23 100644 --- a/pkg/consts/rbac.go +++ b/pkg/consts/rbac.go @@ -1,6 +1,6 @@ package consts -import "go-template/internal/schema" +import "leafdev.top/Leaf/api-platform/internal/schema" const ( RoleSuperAdmin schema.UserRole = "super-admin"