From bd9222c2c8cd8e790baca2b9e81cc91cd0990524 Mon Sep 17 00:00:00 2001 From: Bowen Date: Wed, 31 Dec 2025 12:14:58 +0800 Subject: [PATCH 1/4] upgrade: v1.17 --- .air.toml | 6 +- .gitignore | 7 +- .vscode/launch.json | 15 ++ app/console/commands/test.go | 30 +++ app/console/kernel.go | 17 -- app/facades/app.go | 10 + app/facades/artisan.go | 9 + app/facades/auth.go | 10 + app/facades/cache.go | 9 + app/facades/config.go | 9 + app/facades/crypt.go | 9 + app/facades/db.go | 9 + app/facades/event.go | 9 + app/facades/gate.go | 10 + app/facades/grpc.go | 9 + app/facades/hash.go | 9 + app/facades/http.go | 9 + app/facades/lang.go | 11 + app/facades/log.go | 9 + app/facades/mail.go | 9 + app/facades/orm.go | 9 + app/facades/process.go | 9 + app/facades/queue.go | 9 + app/facades/rate_limiter.go | 9 + app/facades/route.go | 9 + app/facades/schedule.go | 9 + app/facades/schema.go | 9 + app/facades/seeder.go | 9 + app/facades/session.go | 9 + app/facades/storage.go | 9 + app/facades/telemetry.go | 9 + app/facades/testing.go | 9 + app/facades/validation.go | 9 + app/facades/view.go | 9 + app/filters/test.go | 44 ++++ app/grpc/controllers/user_controller.go | 3 +- app/grpc/interceptors/helper.go | 3 +- app/grpc/interceptors/opentracing_client.go | 36 +--- app/grpc/interceptors/opentracing_server.go | 30 +-- app/grpc/kernel.go | 19 -- app/http/controllers/auth_controller.go | 3 +- app/http/controllers/db_controller.go | 3 +- app/http/controllers/lang_controller.go | 3 +- app/http/controllers/user_controller.go | 3 +- app/http/controllers/validation_controller.go | 3 +- app/http/kernel.go | 19 -- app/http/middleware/jwt.go | 3 +- app/http/middleware/lang.go | 3 +- app/http/middleware/session.go | 3 +- app/providers/app_service_provider.go | 16 -- app/providers/auth_service_provider.go | 3 +- app/providers/console_service_provider.go | 21 -- app/providers/database_service_provider.go | 21 -- app/providers/event_service_provider.go | 32 --- app/providers/grpc_service_provider.go | 24 --- app/providers/queue_service_provider.go | 27 --- app/providers/route_service_provider.go | 18 +- app/providers/validation_service_provider.go | 36 ---- app/rules/exists.go | 3 +- app/rules/not_exists.go | 3 +- app/services/user.go | 2 +- bootstrap/app.go | 80 +++++++- bootstrap/commands.go | 13 ++ bootstrap/filters.go | 13 ++ database/kernel.go => bootstrap/migrations.go | 19 +- bootstrap/providers.go | 80 ++++++++ config/app.go | 83 +------- config/auth.go | 2 +- config/cache.go | 3 +- config/cors.go | 2 +- config/database.go | 3 +- config/filesystems.go | 3 +- config/grpc.go | 3 +- config/hashing.go | 2 +- config/http.go | 3 +- config/jwt.go | 2 +- config/logging.go | 8 +- config/mail.go | 2 +- config/queue.go | 3 +- config/session.go | 3 +- config/telemetry.go | 191 ++++++++++++++++++ .../20210101000001_create_users_table.go | 3 +- .../20210101000002_create_jobs_table.go | 3 +- ...250330911908_add_columns_to_users_table.go | 3 +- ...0331093125_alert_columns_of_users_table.go | 3 +- go.mod | 67 ++++-- go.sum | 154 +++++++++----- main.go | 2 +- package_test.go | 3 +- packages/sms/setup/config/sms.go | 2 +- packages/sms/setup/setup.go | 26 +-- routes/api.go | 3 +- routes/graphql.go | 3 +- routes/grpc.go | 3 +- routes/web.go | 3 +- tests/feature/db_drivers_test.go | 3 +- tests/feature/db_test.go | 3 +- tests/feature/event_test.go | 3 +- tests/feature/fiber_test.go | 3 +- tests/feature/filesystem_test.go | 3 +- tests/feature/http_client_test.go | 3 +- tests/feature/main_test.go | 3 +- tests/feature/migration_test.go | 3 +- tests/feature/orm_test.go | 3 +- tests/feature/queue_test.go | 3 +- tests/feature/redis_test.go | 3 +- tests/services/main_test.go | 3 +- 107 files changed, 999 insertions(+), 558 deletions(-) create mode 100644 .vscode/launch.json create mode 100755 app/console/commands/test.go delete mode 100644 app/console/kernel.go create mode 100644 app/facades/app.go create mode 100644 app/facades/artisan.go create mode 100755 app/facades/auth.go create mode 100755 app/facades/cache.go create mode 100644 app/facades/config.go create mode 100755 app/facades/crypt.go create mode 100755 app/facades/db.go create mode 100755 app/facades/event.go create mode 100755 app/facades/gate.go create mode 100755 app/facades/grpc.go create mode 100755 app/facades/hash.go create mode 100755 app/facades/http.go create mode 100755 app/facades/lang.go create mode 100755 app/facades/log.go create mode 100755 app/facades/mail.go create mode 100755 app/facades/orm.go create mode 100755 app/facades/process.go create mode 100755 app/facades/queue.go create mode 100755 app/facades/rate_limiter.go create mode 100755 app/facades/route.go create mode 100755 app/facades/schedule.go create mode 100755 app/facades/schema.go create mode 100755 app/facades/seeder.go create mode 100755 app/facades/session.go create mode 100755 app/facades/storage.go create mode 100755 app/facades/telemetry.go create mode 100755 app/facades/testing.go create mode 100755 app/facades/validation.go create mode 100755 app/facades/view.go create mode 100755 app/filters/test.go delete mode 100644 app/grpc/kernel.go delete mode 100644 app/http/kernel.go delete mode 100644 app/providers/app_service_provider.go delete mode 100644 app/providers/console_service_provider.go delete mode 100644 app/providers/database_service_provider.go delete mode 100644 app/providers/event_service_provider.go delete mode 100644 app/providers/grpc_service_provider.go delete mode 100644 app/providers/queue_service_provider.go delete mode 100644 app/providers/validation_service_provider.go create mode 100755 bootstrap/commands.go create mode 100755 bootstrap/filters.go rename database/kernel.go => bootstrap/migrations.go (54%) create mode 100644 bootstrap/providers.go create mode 100755 config/telemetry.go diff --git a/.air.toml b/.air.toml index 1420ec6..d8be806 100644 --- a/.air.toml +++ b/.air.toml @@ -1,9 +1,9 @@ root = "." -tmp_dir = "storage/temp" +tmp_dir = "tmp" [build] - bin = "./storage/temp/main" - cmd = "go build -o ./storage/temp/main ." + bin = "./tmp/main.exe" + cmd = "go build -o ./tmp/main.exe ." delay = 1000 exclude_dir = ["storage", "database"] exclude_file = [] diff --git a/.gitignore b/.gitignore index 4d66fac..5fe9c8e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ .idea .DS_Store -storage/framework -launch.json \ No newline at end of file +.env +.env.* +!.env.example +storage +tmp diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..59ece5b --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Goravel", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "${fileDirname}" + } + ] +} \ No newline at end of file diff --git a/app/console/commands/test.go b/app/console/commands/test.go new file mode 100755 index 0000000..3d59603 --- /dev/null +++ b/app/console/commands/test.go @@ -0,0 +1,30 @@ +package commands + +import ( + "github.com/goravel/framework/contracts/console" + "github.com/goravel/framework/contracts/console/command" +) + +type Test struct { +} + +// Signature The name and signature of the console command. +func (r *Test) Signature() string { + return "app:test" +} + +// Description The console command description. +func (r *Test) Description() string { + return "Command description" +} + +// Extend The console command extend. +func (r *Test) Extend() command.Extend { + return command.Extend{Category: "app"} +} + +// Handle Execute the console command. +func (r *Test) Handle(ctx console.Context) error { + + return nil +} diff --git a/app/console/kernel.go b/app/console/kernel.go deleted file mode 100644 index db29441..0000000 --- a/app/console/kernel.go +++ /dev/null @@ -1,17 +0,0 @@ -package console - -import ( - "github.com/goravel/framework/contracts/console" - "github.com/goravel/framework/contracts/schedule" -) - -type Kernel struct { -} - -func (kernel *Kernel) Schedule() []schedule.Event { - return []schedule.Event{} -} - -func (kernel *Kernel) Commands() []console.Command { - return []console.Command{} -} diff --git a/app/facades/app.go b/app/facades/app.go new file mode 100644 index 0000000..6ea5c8c --- /dev/null +++ b/app/facades/app.go @@ -0,0 +1,10 @@ +package facades + +import ( + contractsfoundation "github.com/goravel/framework/contracts/foundation" + "github.com/goravel/framework/foundation" +) + +func App() contractsfoundation.Application { + return foundation.App +} diff --git a/app/facades/artisan.go b/app/facades/artisan.go new file mode 100644 index 0000000..190f0a4 --- /dev/null +++ b/app/facades/artisan.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/console" +) + +func Artisan() console.Artisan { + return App().MakeArtisan() +} diff --git a/app/facades/auth.go b/app/facades/auth.go new file mode 100755 index 0000000..f7da0eb --- /dev/null +++ b/app/facades/auth.go @@ -0,0 +1,10 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/auth" + "github.com/goravel/framework/contracts/http" +) + +func Auth(ctx ...http.Context) auth.Auth { + return App().MakeAuth(ctx...) +} diff --git a/app/facades/cache.go b/app/facades/cache.go new file mode 100755 index 0000000..de3c320 --- /dev/null +++ b/app/facades/cache.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/cache" +) + +func Cache() cache.Cache { + return App().MakeCache() +} diff --git a/app/facades/config.go b/app/facades/config.go new file mode 100644 index 0000000..a9d22bc --- /dev/null +++ b/app/facades/config.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/config" +) + +func Config() config.Config { + return App().MakeConfig() +} diff --git a/app/facades/crypt.go b/app/facades/crypt.go new file mode 100755 index 0000000..e2f3a2a --- /dev/null +++ b/app/facades/crypt.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/crypt" +) + +func Crypt() crypt.Crypt { + return App().MakeCrypt() +} diff --git a/app/facades/db.go b/app/facades/db.go new file mode 100755 index 0000000..bbb49dc --- /dev/null +++ b/app/facades/db.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/database/db" +) + +func DB() db.DB { + return App().MakeDB() +} diff --git a/app/facades/event.go b/app/facades/event.go new file mode 100755 index 0000000..bd1049d --- /dev/null +++ b/app/facades/event.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/event" +) + +func Event() event.Instance { + return App().MakeEvent() +} diff --git a/app/facades/gate.go b/app/facades/gate.go new file mode 100755 index 0000000..00eb6c6 --- /dev/null +++ b/app/facades/gate.go @@ -0,0 +1,10 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/auth/access" + "github.com/goravel/framework/contracts/http" +) + +func Gate(ctx ...http.Context) access.Gate { + return App().MakeGate() +} diff --git a/app/facades/grpc.go b/app/facades/grpc.go new file mode 100755 index 0000000..1896361 --- /dev/null +++ b/app/facades/grpc.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/grpc" +) + +func Grpc() grpc.Grpc { + return App().MakeGrpc() +} diff --git a/app/facades/hash.go b/app/facades/hash.go new file mode 100755 index 0000000..f032e95 --- /dev/null +++ b/app/facades/hash.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/hash" +) + +func Hash() hash.Hash { + return App().MakeHash() +} diff --git a/app/facades/http.go b/app/facades/http.go new file mode 100755 index 0000000..57c1bfd --- /dev/null +++ b/app/facades/http.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/http/client" +) + +func Http() client.Request { + return App().MakeHttp() +} diff --git a/app/facades/lang.go b/app/facades/lang.go new file mode 100755 index 0000000..9a1eaaf --- /dev/null +++ b/app/facades/lang.go @@ -0,0 +1,11 @@ +package facades + +import ( + "context" + + "github.com/goravel/framework/contracts/translation" +) + +func Lang(ctx context.Context) translation.Translator { + return App().MakeLang(ctx) +} diff --git a/app/facades/log.go b/app/facades/log.go new file mode 100755 index 0000000..55e202c --- /dev/null +++ b/app/facades/log.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/log" +) + +func Log() log.Log { + return App().MakeLog() +} diff --git a/app/facades/mail.go b/app/facades/mail.go new file mode 100755 index 0000000..f7c778a --- /dev/null +++ b/app/facades/mail.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/mail" +) + +func Mail() mail.Mail { + return App().MakeMail() +} diff --git a/app/facades/orm.go b/app/facades/orm.go new file mode 100755 index 0000000..0556a74 --- /dev/null +++ b/app/facades/orm.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/database/orm" +) + +func Orm() orm.Orm { + return App().MakeOrm() +} diff --git a/app/facades/process.go b/app/facades/process.go new file mode 100755 index 0000000..466ee19 --- /dev/null +++ b/app/facades/process.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/process" +) + +func Process() process.Process { + return App().MakeProcess() +} diff --git a/app/facades/queue.go b/app/facades/queue.go new file mode 100755 index 0000000..7d44cda --- /dev/null +++ b/app/facades/queue.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/queue" +) + +func Queue() queue.Queue { + return App().MakeQueue() +} diff --git a/app/facades/rate_limiter.go b/app/facades/rate_limiter.go new file mode 100755 index 0000000..2dbf931 --- /dev/null +++ b/app/facades/rate_limiter.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/http" +) + +func RateLimiter() http.RateLimiter { + return App().MakeRateLimiter() +} diff --git a/app/facades/route.go b/app/facades/route.go new file mode 100755 index 0000000..e6af86e --- /dev/null +++ b/app/facades/route.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/route" +) + +func Route() route.Route { + return App().MakeRoute() +} diff --git a/app/facades/schedule.go b/app/facades/schedule.go new file mode 100755 index 0000000..2d57490 --- /dev/null +++ b/app/facades/schedule.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/schedule" +) + +func Schedule() schedule.Schedule { + return App().MakeSchedule() +} diff --git a/app/facades/schema.go b/app/facades/schema.go new file mode 100755 index 0000000..a1b43af --- /dev/null +++ b/app/facades/schema.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/database/schema" +) + +func Schema() schema.Schema { + return App().MakeSchema() +} diff --git a/app/facades/seeder.go b/app/facades/seeder.go new file mode 100755 index 0000000..4905bd7 --- /dev/null +++ b/app/facades/seeder.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/database/seeder" +) + +func Seeder() seeder.Facade { + return App().MakeSeeder() +} diff --git a/app/facades/session.go b/app/facades/session.go new file mode 100755 index 0000000..514b876 --- /dev/null +++ b/app/facades/session.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/session" +) + +func Session() session.Manager { + return App().MakeSession() +} diff --git a/app/facades/storage.go b/app/facades/storage.go new file mode 100755 index 0000000..8a29c1d --- /dev/null +++ b/app/facades/storage.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/filesystem" +) + +func Storage() filesystem.Storage { + return App().MakeStorage() +} diff --git a/app/facades/telemetry.go b/app/facades/telemetry.go new file mode 100755 index 0000000..78dba26 --- /dev/null +++ b/app/facades/telemetry.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/telemetry" +) + +func Telemetry() telemetry.Telemetry { + return App().MakeTelemetry() +} diff --git a/app/facades/testing.go b/app/facades/testing.go new file mode 100755 index 0000000..7672111 --- /dev/null +++ b/app/facades/testing.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/testing" +) + +func Testing() testing.Testing { + return App().MakeTesting() +} diff --git a/app/facades/validation.go b/app/facades/validation.go new file mode 100755 index 0000000..586f458 --- /dev/null +++ b/app/facades/validation.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/validation" +) + +func Validation() validation.Validation { + return App().MakeValidation() +} diff --git a/app/facades/view.go b/app/facades/view.go new file mode 100755 index 0000000..ffa3375 --- /dev/null +++ b/app/facades/view.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/view" +) + +func View() view.View { + return App().MakeView() +} diff --git a/app/filters/test.go b/app/filters/test.go new file mode 100755 index 0000000..d441b67 --- /dev/null +++ b/app/filters/test.go @@ -0,0 +1,44 @@ +package filters + +type Test struct { +} + +// Signature The signature of the filter. +func (receiver *Test) Signature() string { + return "test" +} + +// Handle defines the filter function to apply. +// +// The Handle method should return a function that processes an input and +// returns a transformed value. The function can either return the +// transformed value alone or a tuple of the transformed value and an error. +// The input to the filter function is flexible: the first input is the value +// of the key on which the filter is applied, and the rest of the inputs are +// the arguments passed to the filter. +// +// Example usages: +// +// 1. Return only the transformed value: +// func (val string) int { +// // conversion logic +// return 1 +// } +// +// 2. Return the transformed value and an error: +// func (val int) (int, error) { +// // conversion logic with error handling +// return 1, nil +// } +// +// 3. Take additional arguments: +// func (val string, def ...string) string { +// if val == "" && len(def) > 0 { +// return def[0] +// } +// return val +// } +// +func (receiver *Test) Handle() any { + return nil +} diff --git a/app/grpc/controllers/user_controller.go b/app/grpc/controllers/user_controller.go index 2a227f8..c12e63f 100644 --- a/app/grpc/controllers/user_controller.go +++ b/app/grpc/controllers/user_controller.go @@ -4,10 +4,11 @@ import ( "context" "net/http" + "goravel/app/facades" + proto "github.com/goravel/example-proto" "github.com/goravel/framework/auth" contractshttp "github.com/goravel/framework/contracts/http" - "github.com/goravel/framework/facades" goravelhttp "github.com/goravel/framework/http" "github.com/pkg/errors" diff --git a/app/grpc/interceptors/helper.go b/app/grpc/interceptors/helper.go index bceb4da..4b037e0 100644 --- a/app/grpc/interceptors/helper.go +++ b/app/grpc/interceptors/helper.go @@ -4,7 +4,8 @@ import ( "io" "strings" - "github.com/goravel/framework/facades" + "goravel/app/facades" + "github.com/opentracing/opentracing-go" "github.com/uber/jaeger-client-go" "github.com/uber/jaeger-client-go/transport" diff --git a/app/grpc/interceptors/opentracing_client.go b/app/grpc/interceptors/opentracing_client.go index 579de61..a359dc3 100644 --- a/app/grpc/interceptors/opentracing_client.go +++ b/app/grpc/interceptors/opentracing_client.go @@ -3,41 +3,9 @@ package interceptors import ( "context" - "github.com/opentracing/opentracing-go" - "github.com/opentracing/opentracing-go/ext" - "github.com/opentracing/opentracing-go/log" - "github.com/pkg/errors" "google.golang.org/grpc" - "google.golang.org/grpc/metadata" ) -func OpentracingClient(tracer opentracing.Tracer, parentCtx context.Context) grpc.UnaryClientInterceptor { - return func(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, - invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { - span, _ := opentracing.StartSpanFromContext(parentCtx, - "call gRPC", - opentracing.Tag{Key: string(ext.Component), Value: "gRPC"}, - ext.SpanKindRPCClient) - - defer span.Finish() - - md, ok := metadata.FromOutgoingContext(ctx) - if !ok { - md = metadata.New(nil) - } else { - md = md.Copy() - } - - err := tracer.Inject(span.Context(), opentracing.TextMap, MDReaderWriter{md}) - if err != nil { - span.LogFields(log.Error(errors.WithMessage(err, "inject-error"))) - } - - newCtx := metadata.NewOutgoingContext(ctx, md) - err = invoker(newCtx, method, req, reply, cc, opts...) - if err != nil { - span.LogFields(log.Error(errors.WithMessage(err, "call-error"))) - } - return err - } +func OpentracingClient(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { + return nil } diff --git a/app/grpc/interceptors/opentracing_server.go b/app/grpc/interceptors/opentracing_server.go index a6963e7..97e5455 100644 --- a/app/grpc/interceptors/opentracing_server.go +++ b/app/grpc/interceptors/opentracing_server.go @@ -2,36 +2,10 @@ package interceptors import ( "context" - "fmt" - "github.com/opentracing/opentracing-go" - "github.com/opentracing/opentracing-go/ext" "google.golang.org/grpc" - "google.golang.org/grpc/metadata" ) -func OpentracingServer(tracer opentracing.Tracer) grpc.UnaryServerInterceptor { - return func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error) { - var parentCtx context.Context - - md, ok := metadata.FromIncomingContext(ctx) - if !ok { - md = metadata.New(nil) - } - spanContext, err := tracer.Extract(opentracing.TextMap, MDReaderWriter{md}) - if err != nil { - return nil, fmt.Errorf("extract from metadata error: %v", err) - } else { - span := tracer.StartSpan( - info.FullMethod, - ext.RPCServerOption(spanContext), - opentracing.Tag{Key: string(ext.Component), Value: "gRPC"}, - ext.SpanKindRPCServer, - ) - defer span.Finish() - parentCtx = opentracing.ContextWithSpan(ctx, span) - } - - return handler(parentCtx, req) - } +func OpentracingServer(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error) { + return handler(ctx, req) } diff --git a/app/grpc/kernel.go b/app/grpc/kernel.go deleted file mode 100644 index 3804f81..0000000 --- a/app/grpc/kernel.go +++ /dev/null @@ -1,19 +0,0 @@ -package grpc - -import ( - "google.golang.org/grpc" -) - -type Kernel struct { -} - -// The application's global GRPC interceptor stack. -// These middleware are run during every request to your application. -func (kernel *Kernel) UnaryServerInterceptors() []grpc.UnaryServerInterceptor { - return []grpc.UnaryServerInterceptor{} -} - -// The application's client interceptor groups. -func (kernel *Kernel) UnaryClientInterceptorGroups() map[string][]grpc.UnaryClientInterceptor { - return map[string][]grpc.UnaryClientInterceptor{} -} diff --git a/app/http/controllers/auth_controller.go b/app/http/controllers/auth_controller.go index bfcdc0c..96f6c59 100644 --- a/app/http/controllers/auth_controller.go +++ b/app/http/controllers/auth_controller.go @@ -1,8 +1,9 @@ package controllers import ( + "goravel/app/facades" + "github.com/goravel/framework/contracts/http" - "github.com/goravel/framework/facades" "github.com/spf13/cast" "goravel/app/models" diff --git a/app/http/controllers/db_controller.go b/app/http/controllers/db_controller.go index af39bb1..b3fb460 100644 --- a/app/http/controllers/db_controller.go +++ b/app/http/controllers/db_controller.go @@ -1,8 +1,9 @@ package controllers import ( + "goravel/app/facades" + "github.com/goravel/framework/contracts/http" - "github.com/goravel/framework/facades" "goravel/app/models" ) diff --git a/app/http/controllers/lang_controller.go b/app/http/controllers/lang_controller.go index 25b0150..719c366 100644 --- a/app/http/controllers/lang_controller.go +++ b/app/http/controllers/lang_controller.go @@ -1,8 +1,9 @@ package controllers import ( + "goravel/app/facades" + "github.com/goravel/framework/contracts/http" - "github.com/goravel/framework/facades" ) type LangController struct { diff --git a/app/http/controllers/user_controller.go b/app/http/controllers/user_controller.go index dcdd181..e70e723 100644 --- a/app/http/controllers/user_controller.go +++ b/app/http/controllers/user_controller.go @@ -1,8 +1,9 @@ package controllers import ( + "goravel/app/facades" + "github.com/goravel/framework/contracts/http" - "github.com/goravel/framework/facades" "goravel/app/http/requests" "goravel/app/models" diff --git a/app/http/controllers/validation_controller.go b/app/http/controllers/validation_controller.go index edd0bd7..5e69822 100644 --- a/app/http/controllers/validation_controller.go +++ b/app/http/controllers/validation_controller.go @@ -1,8 +1,9 @@ package controllers import ( + "goravel/app/facades" + "github.com/goravel/framework/contracts/http" - "github.com/goravel/framework/facades" "github.com/goravel/framework/support/carbon" "goravel/app/http/requests" diff --git a/app/http/kernel.go b/app/http/kernel.go deleted file mode 100644 index 58a748d..0000000 --- a/app/http/kernel.go +++ /dev/null @@ -1,19 +0,0 @@ -package http - -import ( - "github.com/goravel/framework/contracts/http" - httpmiddleware "github.com/goravel/framework/http/middleware" - "github.com/goravel/framework/session/middleware" -) - -type Kernel struct { -} - -// The application's global HTTP middleware stack. -// These middleware are run during every request to your application. -func (kernel Kernel) Middleware() []http.Middleware { - return []http.Middleware{ - httpmiddleware.Throttle("global"), - middleware.StartSession(), - } -} diff --git a/app/http/middleware/jwt.go b/app/http/middleware/jwt.go index 2189d6c..cd10124 100644 --- a/app/http/middleware/jwt.go +++ b/app/http/middleware/jwt.go @@ -3,9 +3,10 @@ package middleware import ( "errors" + "goravel/app/facades" + "github.com/goravel/framework/auth" "github.com/goravel/framework/contracts/http" - "github.com/goravel/framework/facades" ) func Jwt() http.Middleware { diff --git a/app/http/middleware/lang.go b/app/http/middleware/lang.go index ee7c199..98b6d3b 100644 --- a/app/http/middleware/lang.go +++ b/app/http/middleware/lang.go @@ -1,8 +1,9 @@ package middleware import ( + "goravel/app/facades" + httpcontract "github.com/goravel/framework/contracts/http" - "github.com/goravel/framework/facades" ) func Lang() httpcontract.Middleware { diff --git a/app/http/middleware/session.go b/app/http/middleware/session.go index a31f639..dd00db5 100644 --- a/app/http/middleware/session.go +++ b/app/http/middleware/session.go @@ -3,8 +3,9 @@ package middleware import ( "goravel/app/models" + "goravel/app/facades" + "github.com/goravel/framework/contracts/http" - "github.com/goravel/framework/facades" ) func Session() http.Middleware { diff --git a/app/providers/app_service_provider.go b/app/providers/app_service_provider.go deleted file mode 100644 index a4dd934..0000000 --- a/app/providers/app_service_provider.go +++ /dev/null @@ -1,16 +0,0 @@ -package providers - -import ( - "github.com/goravel/framework/contracts/foundation" -) - -type AppServiceProvider struct { -} - -func (receiver *AppServiceProvider) Register(app foundation.Application) { - -} - -func (receiver *AppServiceProvider) Boot(app foundation.Application) { - -} diff --git a/app/providers/auth_service_provider.go b/app/providers/auth_service_provider.go index 3541646..5caa601 100644 --- a/app/providers/auth_service_provider.go +++ b/app/providers/auth_service_provider.go @@ -1,9 +1,10 @@ package providers import ( + "goravel/app/facades" + frameworkauth "github.com/goravel/framework/auth" "github.com/goravel/framework/contracts/foundation" - "github.com/goravel/framework/facades" ) type AuthServiceProvider struct { diff --git a/app/providers/console_service_provider.go b/app/providers/console_service_provider.go deleted file mode 100644 index f26a6fc..0000000 --- a/app/providers/console_service_provider.go +++ /dev/null @@ -1,21 +0,0 @@ -package providers - -import ( - "github.com/goravel/framework/contracts/foundation" - "github.com/goravel/framework/facades" - - "goravel/app/console" -) - -type ConsoleServiceProvider struct { -} - -func (receiver *ConsoleServiceProvider) Register(app foundation.Application) { - kernel := console.Kernel{} - facades.Schedule().Register(kernel.Schedule()) - facades.Artisan().Register(kernel.Commands()) -} - -func (receiver *ConsoleServiceProvider) Boot(app foundation.Application) { - -} diff --git a/app/providers/database_service_provider.go b/app/providers/database_service_provider.go deleted file mode 100644 index 57c0bc2..0000000 --- a/app/providers/database_service_provider.go +++ /dev/null @@ -1,21 +0,0 @@ -package providers - -import ( - "github.com/goravel/framework/contracts/foundation" - "github.com/goravel/framework/facades" - - "goravel/database" -) - -type DatabaseServiceProvider struct { -} - -func (receiver *DatabaseServiceProvider) Register(app foundation.Application) { - -} - -func (receiver *DatabaseServiceProvider) Boot(app foundation.Application) { - kernel := database.Kernel{} - facades.Schema().Register(kernel.Migrations()) - facades.Seeder().Register(kernel.Seeders()) -} diff --git a/app/providers/event_service_provider.go b/app/providers/event_service_provider.go deleted file mode 100644 index c7b914b..0000000 --- a/app/providers/event_service_provider.go +++ /dev/null @@ -1,32 +0,0 @@ -package providers - -import ( - "github.com/goravel/framework/contracts/event" - "github.com/goravel/framework/contracts/foundation" - "github.com/goravel/framework/facades" - - "goravel/app/events" - "goravel/app/listeners" -) - -type EventServiceProvider struct { -} - -func (receiver *EventServiceProvider) Register(app foundation.Application) { - facades.Event().Register(receiver.listen()) -} - -func (receiver *EventServiceProvider) Boot(app foundation.Application) { - -} - -func (receiver *EventServiceProvider) listen() map[event.Event][]event.Listener { - return map[event.Event][]event.Listener{ - events.NewOrderShipped(): { - listeners.NewSendShipmentNotification(), - }, - events.NewOrderCanceled(): { - listeners.NewSendShipmentNotification(), - }, - } -} diff --git a/app/providers/grpc_service_provider.go b/app/providers/grpc_service_provider.go deleted file mode 100644 index 86e4245..0000000 --- a/app/providers/grpc_service_provider.go +++ /dev/null @@ -1,24 +0,0 @@ -package providers - -import ( - "github.com/goravel/framework/contracts/foundation" - "github.com/goravel/framework/facades" - - "goravel/app/grpc" - "goravel/routes" -) - -type GrpcServiceProvider struct { -} - -func (receiver *GrpcServiceProvider) Register(app foundation.Application) { - // Add Grpc interceptors - kernel := grpc.Kernel{} - facades.Grpc().UnaryServerInterceptors(kernel.UnaryServerInterceptors()) - facades.Grpc().UnaryClientInterceptorGroups(kernel.UnaryClientInterceptorGroups()) -} - -func (receiver *GrpcServiceProvider) Boot(app foundation.Application) { - // Add routes - routes.Grpc() -} diff --git a/app/providers/queue_service_provider.go b/app/providers/queue_service_provider.go deleted file mode 100644 index 7a5ba55..0000000 --- a/app/providers/queue_service_provider.go +++ /dev/null @@ -1,27 +0,0 @@ -package providers - -import ( - "github.com/goravel/framework/contracts/foundation" - "github.com/goravel/framework/contracts/queue" - "github.com/goravel/framework/facades" - - "goravel/app/jobs" -) - -type QueueServiceProvider struct { -} - -func (receiver *QueueServiceProvider) Register(app foundation.Application) { - facades.Queue().Register(receiver.Jobs()) -} - -func (receiver *QueueServiceProvider) Boot(app foundation.Application) { - -} - -func (receiver *QueueServiceProvider) Jobs() []queue.Job { - return []queue.Job{ - &jobs.Test{}, - &jobs.TestErr{}, - } -} diff --git a/app/providers/route_service_provider.go b/app/providers/route_service_provider.go index 06afb18..4bebfb1 100644 --- a/app/providers/route_service_provider.go +++ b/app/providers/route_service_provider.go @@ -1,13 +1,11 @@ package providers import ( + "goravel/app/facades" + "github.com/goravel/framework/contracts/foundation" contractshttp "github.com/goravel/framework/contracts/http" - "github.com/goravel/framework/facades" "github.com/goravel/framework/http/limit" - - "goravel/app/http" - "goravel/routes" ) type RouteServiceProvider struct { @@ -17,19 +15,7 @@ func (receiver *RouteServiceProvider) Register(app foundation.Application) { } func (receiver *RouteServiceProvider) Boot(app foundation.Application) { - // Add HTTP middleware - facades.Route().GlobalMiddleware(http.Kernel{}.Middleware()...) - facades.Route().Recover(func(ctx contractshttp.Context, err any) { - facades.Log().Error(err) - _ = ctx.Response().String(contractshttp.StatusInternalServerError, "recover").Abort() - }) - receiver.configureRateLimiting() - - // Add routes - routes.Web() - routes.Api() - routes.Graphql() } func (receiver *RouteServiceProvider) configureRateLimiting() { diff --git a/app/providers/validation_service_provider.go b/app/providers/validation_service_provider.go deleted file mode 100644 index eed101b..0000000 --- a/app/providers/validation_service_provider.go +++ /dev/null @@ -1,36 +0,0 @@ -package providers - -import ( - "github.com/goravel/framework/contracts/foundation" - "github.com/goravel/framework/contracts/validation" - "github.com/goravel/framework/facades" - - "goravel/app/rules" -) - -type ValidationServiceProvider struct { -} - -func (receiver *ValidationServiceProvider) Register(app foundation.Application) { - -} - -func (receiver *ValidationServiceProvider) Boot(app foundation.Application) { - if err := facades.Validation().AddRules(receiver.rules()); err != nil { - facades.Log().Errorf("add rules error: %+v", err) - } - if err := facades.Validation().AddFilters(receiver.filters()); err != nil { - facades.Log().Errorf("add filters error: %+v", err) - } -} - -func (receiver *ValidationServiceProvider) rules() []validation.Rule { - return []validation.Rule{ - &rules.Exists{}, - &rules.NotExists{}, - } -} - -func (receiver *ValidationServiceProvider) filters() []validation.Filter { - return []validation.Filter{} -} diff --git a/app/rules/exists.go b/app/rules/exists.go index 2cd9d6d..cfb3d7a 100644 --- a/app/rules/exists.go +++ b/app/rules/exists.go @@ -1,8 +1,9 @@ package rules import ( + "goravel/app/facades" + "github.com/goravel/framework/contracts/validation" - "github.com/goravel/framework/facades" ) /** diff --git a/app/rules/not_exists.go b/app/rules/not_exists.go index fc726d7..a1c9bb7 100644 --- a/app/rules/not_exists.go +++ b/app/rules/not_exists.go @@ -1,8 +1,9 @@ package rules import ( + "goravel/app/facades" + "github.com/goravel/framework/contracts/validation" - "github.com/goravel/framework/facades" ) /** diff --git a/app/services/user.go b/app/services/user.go index 44641e8..731026b 100644 --- a/app/services/user.go +++ b/app/services/user.go @@ -1,7 +1,7 @@ package services import ( - "github.com/goravel/framework/facades" + "goravel/app/facades" "goravel/app/models" ) diff --git a/bootstrap/app.go b/bootstrap/app.go index 684c041..6156351 100644 --- a/bootstrap/app.go +++ b/bootstrap/app.go @@ -1,17 +1,83 @@ package bootstrap import ( + "github.com/goravel/framework/contracts/database/seeder" + "github.com/goravel/framework/contracts/event" + "github.com/goravel/framework/contracts/foundation/configuration" + "github.com/goravel/framework/contracts/http" + contractshttp "github.com/goravel/framework/contracts/http" + "github.com/goravel/framework/contracts/queue" + "github.com/goravel/framework/contracts/schedule" + "github.com/goravel/framework/contracts/validation" "github.com/goravel/framework/foundation" + httpmiddleware "github.com/goravel/framework/http/middleware" + "github.com/goravel/framework/session/middleware" + "google.golang.org/grpc" + "google.golang.org/grpc/stats" + "goravel/app/events" + "goravel/app/facades" + "goravel/app/grpc/interceptors" + "goravel/app/jobs" + "goravel/app/listeners" + "goravel/app/rules" "goravel/config" + "goravel/database/seeders" + "goravel/routes" ) func Boot() { - app := foundation.NewApplication() - - // Bootstrap the application - app.Boot() - - // Bootstrap the config. - config.Boot() + foundation.Setup(). + WithFilters(Filters()). + WithCommands(Commands()). + WithMigrations(Migrations()). + WithSeeders([]seeder.Seeder{ + &seeders.DatabaseSeeder{}, + }). + WithRouting([]func(){ + routes.Web, + routes.Grpc, + routes.Graphql, + }). + WithEvents(map[event.Event][]event.Listener{ + events.NewOrderShipped(): { + listeners.NewSendShipmentNotification(), + }, + events.NewOrderCanceled(): { + listeners.NewSendShipmentNotification(), + }, + }). + WithJobs([]queue.Job{ + &jobs.Test{}, + &jobs.TestErr{}, + }). + WithRules([]validation.Rule{ + &rules.Exists{}, + &rules.NotExists{}, + }). + WithMiddleware(func(handler configuration.Middleware) { + handler.Append(httpmiddleware.Throttle("global"), middleware.StartSession()).Recover(func(ctx http.Context, err any) { + facades.Log().Error(err) + _ = ctx.Response().String(contractshttp.StatusInternalServerError, "recover").Abort() + }) + }). + WithGrpcServerInterceptors([]grpc.UnaryServerInterceptor{ + interceptors.OpentracingServer, + }). + WithGrpcClientInterceptors(map[string][]grpc.UnaryClientInterceptor{ + "default": { + interceptors.OpentracingClient, + }, + }). + WithGrpcServerStatsHandlers([]stats.Handler{}). + WithGrpcClientStatsHandlers(map[string][]stats.Handler{}). + WithPaths(func(paths configuration.Paths) { + paths.App("app") + }). + WithProviders(Providers()). + WithSchedule([]schedule.Event{ + facades.Schedule().Call(func() {}), + }). + WithConfig(config.Boot). + Run() } diff --git a/bootstrap/commands.go b/bootstrap/commands.go new file mode 100755 index 0000000..57c6221 --- /dev/null +++ b/bootstrap/commands.go @@ -0,0 +1,13 @@ +package bootstrap + +import ( + "github.com/goravel/framework/contracts/console" + + "goravel/app/console/commands" +) + +func Commands() []console.Command { + return []console.Command{ + &commands.Test{}, + } +} diff --git a/bootstrap/filters.go b/bootstrap/filters.go new file mode 100755 index 0000000..663ffe8 --- /dev/null +++ b/bootstrap/filters.go @@ -0,0 +1,13 @@ +package bootstrap + +import ( + "github.com/goravel/framework/contracts/validation" + + "goravel/app/filters" +) + +func Filters() []validation.Filter { + return []validation.Filter{ + &filters.Test{}, + } +} diff --git a/database/kernel.go b/bootstrap/migrations.go similarity index 54% rename from database/kernel.go rename to bootstrap/migrations.go index c375283..de2e06c 100644 --- a/database/kernel.go +++ b/bootstrap/migrations.go @@ -1,17 +1,12 @@ -package database +package bootstrap import ( - "github.com/goravel/framework/contracts/database/schema" - "github.com/goravel/framework/contracts/database/seeder" - "goravel/database/migrations" - "goravel/database/seeders" -) -type Kernel struct { -} + "github.com/goravel/framework/contracts/database/schema" +) -func (kernel Kernel) Migrations() []schema.Migration { +func Migrations() []schema.Migration { return []schema.Migration{ &migrations.M20210101000001CreateUsersTable{}, &migrations.M20210101000002CreateJobsTable{}, @@ -19,9 +14,3 @@ func (kernel Kernel) Migrations() []schema.Migration { &migrations.M20250331093125AlertColumnsOfUsersTable{}, } } - -func (kernel Kernel) Seeders() []seeder.Seeder { - return []seeder.Seeder{ - &seeders.DatabaseSeeder{}, - } -} diff --git a/bootstrap/providers.go b/bootstrap/providers.go new file mode 100644 index 0000000..c5b7480 --- /dev/null +++ b/bootstrap/providers.go @@ -0,0 +1,80 @@ +package bootstrap + +import ( + "goravel/app/providers" + + "github.com/goravel/cos" + "github.com/goravel/fiber" + "github.com/goravel/framework/auth" + "github.com/goravel/framework/cache" + "github.com/goravel/framework/contracts/foundation" + "github.com/goravel/framework/crypt" + "github.com/goravel/framework/database" + "github.com/goravel/framework/event" + "github.com/goravel/framework/filesystem" + "github.com/goravel/framework/grpc" + "github.com/goravel/framework/hash" + "github.com/goravel/framework/http" + "github.com/goravel/framework/log" + "github.com/goravel/framework/mail" + "github.com/goravel/framework/process" + "github.com/goravel/framework/queue" + "github.com/goravel/framework/route" + "github.com/goravel/framework/schedule" + "github.com/goravel/framework/session" + "github.com/goravel/framework/telemetry" + "github.com/goravel/framework/testing" + "github.com/goravel/framework/translation" + "github.com/goravel/framework/validation" + "github.com/goravel/framework/view" + "github.com/goravel/gin" + "github.com/goravel/minio" + "github.com/goravel/mysql" + "github.com/goravel/oss" + "github.com/goravel/postgres" + "github.com/goravel/redis" + "github.com/goravel/s3" + "github.com/goravel/sqlite" + "github.com/goravel/sqlserver" +) + +func Providers() []foundation.ServiceProvider { + return []foundation.ServiceProvider{ + &log.ServiceProvider{}, + &cache.ServiceProvider{}, + &session.ServiceProvider{}, + &validation.ServiceProvider{}, + &http.ServiceProvider{}, + &view.ServiceProvider{}, + &route.ServiceProvider{}, + &gin.ServiceProvider{}, + &database.ServiceProvider{}, + &postgres.ServiceProvider{}, + &auth.ServiceProvider{}, + &crypt.ServiceProvider{}, + &queue.ServiceProvider{}, + &event.ServiceProvider{}, + &grpc.ServiceProvider{}, + &hash.ServiceProvider{}, + &translation.ServiceProvider{}, + &mail.ServiceProvider{}, + &process.ServiceProvider{}, + &schedule.ServiceProvider{}, + &filesystem.ServiceProvider{}, + &telemetry.ServiceProvider{}, + &testing.ServiceProvider{}, + &providers.AuthServiceProvider{}, + &providers.RouteServiceProvider{}, + &postgres.ServiceProvider{}, + &mysql.ServiceProvider{}, + &sqlserver.ServiceProvider{}, + &sqlite.ServiceProvider{}, + &s3.ServiceProvider{}, + &cos.ServiceProvider{}, + &oss.ServiceProvider{}, + &minio.ServiceProvider{}, + &redis.ServiceProvider{}, + &gin.ServiceProvider{}, + &fiber.ServiceProvider{}, + } +} diff --git a/config/app.go b/config/app.go index 30832e7..2f2fedb 100644 --- a/config/app.go +++ b/config/app.go @@ -1,42 +1,9 @@ package config import ( - "github.com/goravel/cos" - "github.com/goravel/fiber" - "github.com/goravel/framework/auth" - "github.com/goravel/framework/cache" - "github.com/goravel/framework/console" - "github.com/goravel/framework/contracts/foundation" - "github.com/goravel/framework/crypt" - "github.com/goravel/framework/database" - "github.com/goravel/framework/event" - "github.com/goravel/framework/facades" - "github.com/goravel/framework/filesystem" - "github.com/goravel/framework/grpc" - "github.com/goravel/framework/hash" - "github.com/goravel/framework/http" - "github.com/goravel/framework/log" - "github.com/goravel/framework/mail" - "github.com/goravel/framework/queue" - "github.com/goravel/framework/route" - "github.com/goravel/framework/schedule" - "github.com/goravel/framework/session" "github.com/goravel/framework/support/carbon" - "github.com/goravel/framework/testing" - "github.com/goravel/framework/translation" - "github.com/goravel/framework/validation" - "github.com/goravel/framework/view" - "github.com/goravel/gin" - "github.com/goravel/minio" - "github.com/goravel/mysql" - "github.com/goravel/oss" - "github.com/goravel/postgres" - "github.com/goravel/redis" - "github.com/goravel/s3" - "github.com/goravel/sqlite" - "github.com/goravel/sqlserver" - "goravel/app/providers" + "goravel/app/facades" "goravel/lang_fs" ) @@ -96,53 +63,5 @@ func init() { // 32 character string, otherwise these encrypted strings // will not be safe. Please do this before deploying an application! "key": config.Env("APP_KEY", ""), - - // Autoload service providers - // - // The service providers listed here will be automatically loaded on the - // request to your application. Feel free to add your own services to - // this array to grant expanded functionality to your applications. - "providers": []foundation.ServiceProvider{ - &log.ServiceProvider{}, - &console.ServiceProvider{}, - &database.ServiceProvider{}, - &cache.ServiceProvider{}, - &http.ServiceProvider{}, - &route.ServiceProvider{}, - &schedule.ServiceProvider{}, - &event.ServiceProvider{}, - &queue.ServiceProvider{}, - &grpc.ServiceProvider{}, - &mail.ServiceProvider{}, - &auth.ServiceProvider{}, - &hash.ServiceProvider{}, - &crypt.ServiceProvider{}, - &filesystem.ServiceProvider{}, - &validation.ServiceProvider{}, - &session.ServiceProvider{}, - &translation.ServiceProvider{}, - &testing.ServiceProvider{}, - &view.ServiceProvider{}, - &providers.AppServiceProvider{}, - &providers.AuthServiceProvider{}, - &providers.RouteServiceProvider{}, - &providers.GrpcServiceProvider{}, - &providers.ConsoleServiceProvider{}, - &providers.QueueServiceProvider{}, - &providers.EventServiceProvider{}, - &providers.ValidationServiceProvider{}, - &providers.DatabaseServiceProvider{}, - &postgres.ServiceProvider{}, - &mysql.ServiceProvider{}, - &sqlserver.ServiceProvider{}, - &sqlite.ServiceProvider{}, - &s3.ServiceProvider{}, - &cos.ServiceProvider{}, - &oss.ServiceProvider{}, - &minio.ServiceProvider{}, - &redis.ServiceProvider{}, - &gin.ServiceProvider{}, - &fiber.ServiceProvider{}, - }, }) } diff --git a/config/auth.go b/config/auth.go index dfa913c..ac6e9dd 100644 --- a/config/auth.go +++ b/config/auth.go @@ -1,7 +1,7 @@ package config import ( - "github.com/goravel/framework/facades" + "goravel/app/facades" ) func init() { diff --git a/config/cache.go b/config/cache.go index 526355b..b0e913c 100644 --- a/config/cache.go +++ b/config/cache.go @@ -2,8 +2,9 @@ package config import ( "github.com/goravel/framework/contracts/cache" - "github.com/goravel/framework/facades" redisfacades "github.com/goravel/redis/facades" + + "goravel/app/facades" ) func init() { diff --git a/config/cors.go b/config/cors.go index f46e5c2..10ad2fa 100644 --- a/config/cors.go +++ b/config/cors.go @@ -1,7 +1,7 @@ package config import ( - "github.com/goravel/framework/facades" + "goravel/app/facades" ) func init() { diff --git a/config/database.go b/config/database.go index 60f91a9..57a6d1b 100644 --- a/config/database.go +++ b/config/database.go @@ -2,11 +2,12 @@ package config import ( "github.com/goravel/framework/contracts/database/driver" - "github.com/goravel/framework/facades" mysqlfacades "github.com/goravel/mysql/facades" postgresfacades "github.com/goravel/postgres/facades" sqlitefacades "github.com/goravel/sqlite/facades" sqlserverfacades "github.com/goravel/sqlserver/facades" + + "goravel/app/facades" ) func init() { diff --git a/config/filesystems.go b/config/filesystems.go index 8f3c6eb..f21cd1b 100644 --- a/config/filesystems.go +++ b/config/filesystems.go @@ -3,11 +3,12 @@ package config import ( cosfacades "github.com/goravel/cos/facades" "github.com/goravel/framework/contracts/filesystem" - "github.com/goravel/framework/facades" "github.com/goravel/framework/support/path" miniofacades "github.com/goravel/minio/facades" ossfacades "github.com/goravel/oss/facades" s3facades "github.com/goravel/s3/facades" + + "goravel/app/facades" ) func init() { diff --git a/config/grpc.go b/config/grpc.go index fa6e54a..4b44b9e 100644 --- a/config/grpc.go +++ b/config/grpc.go @@ -1,7 +1,7 @@ package config import ( - "github.com/goravel/framework/facades" + "goravel/app/facades" ) func init() { @@ -20,6 +20,7 @@ func init() { // "host": config.Env("GRPC_USER_HOST", ""), // "port": config.Env("GRPC_USER_PORT", ""), // "interceptors": []string{}, + // "stats_handlers": []string{}, //}, }, }) diff --git a/config/hashing.go b/config/hashing.go index 8852a00..0bd32ef 100644 --- a/config/hashing.go +++ b/config/hashing.go @@ -1,7 +1,7 @@ package config import ( - "github.com/goravel/framework/facades" + "goravel/app/facades" ) func init() { diff --git a/config/http.go b/config/http.go index d0cc2f4..e23a1f6 100644 --- a/config/http.go +++ b/config/http.go @@ -6,10 +6,11 @@ import ( "github.com/gofiber/template/html/v2" fiberfacades "github.com/goravel/fiber/facades" "github.com/goravel/framework/contracts/route" - "github.com/goravel/framework/facades" "github.com/goravel/framework/support/path" "github.com/goravel/gin" ginfacades "github.com/goravel/gin/facades" + + "goravel/app/facades" ) func init() { diff --git a/config/jwt.go b/config/jwt.go index 7c1f032..ab1c2a3 100644 --- a/config/jwt.go +++ b/config/jwt.go @@ -1,7 +1,7 @@ package config import ( - "github.com/goravel/framework/facades" + "goravel/app/facades" ) func init() { diff --git a/config/logging.go b/config/logging.go index 36bd99f..f6b9125 100644 --- a/config/logging.go +++ b/config/logging.go @@ -1,7 +1,7 @@ package config import ( - "github.com/goravel/framework/facades" + "goravel/app/facades" ) func init() { @@ -17,7 +17,7 @@ func init() { // Log Channels // // Here you may configure the log channels for your application. - // Available Drivers: "single", "daily", "custom", "stack" + // Available Drivers: "single", "daily", "otel", "custom", "stack" // Available Level: "debug", "info", "warning", "error", "fatal", "panic" "channels": map[string]any{ "stack": map[string]any{ @@ -37,6 +37,10 @@ func init() { "days": 7, "print": true, }, + "otel": map[string]any{ + "driver": "otel", + "instrument_name": config.GetString("APP_NAME", "goravel/log"), + }, }, }) } diff --git a/config/mail.go b/config/mail.go index 0439cd6..8f0b18e 100644 --- a/config/mail.go +++ b/config/mail.go @@ -1,6 +1,6 @@ package config -import "github.com/goravel/framework/facades" +import "goravel/app/facades" func init() { config := facades.Config() diff --git a/config/queue.go b/config/queue.go index caef954..fd197e0 100644 --- a/config/queue.go +++ b/config/queue.go @@ -2,8 +2,9 @@ package config import ( "github.com/goravel/framework/contracts/queue" - "github.com/goravel/framework/facades" redisfacades "github.com/goravel/redis/facades" + + "goravel/app/facades" ) func init() { diff --git a/config/session.go b/config/session.go index 07f34da..bd2bace 100644 --- a/config/session.go +++ b/config/session.go @@ -2,10 +2,11 @@ package config import ( "github.com/goravel/framework/contracts/session" - "github.com/goravel/framework/facades" "github.com/goravel/framework/support/path" "github.com/goravel/framework/support/str" redisfacades "github.com/goravel/redis/facades" + + "goravel/app/facades" ) func init() { diff --git a/config/telemetry.go b/config/telemetry.go new file mode 100755 index 0000000..ab056a2 --- /dev/null +++ b/config/telemetry.go @@ -0,0 +1,191 @@ +package config + +import ( + "goravel/app/facades" +) + +func init() { + config := facades.Config() + config.Add("telemetry", map[string]any{ + // Service Identification + // + // Defines the logical identity of the service. This information is attached + // to every trace and metric, allowing observability platforms to group + // data by service name, version, and environment. + // Reference: https://opentelemetry.io/docs/specs/semconv/resource/ + "service": map[string]any{ + "name": config.Env("APP_NAME", "goravel"), + "version": config.Env("APP_VERSION", ""), + "environment": config.Env("APP_ENV", ""), + }, + + // Resource Attributes + // + // Additional custom attributes to attach to the global Resource object. + // These attributes provide static metadata about the entity producing + // telemetry (e.g., "k8s.pod.name", "region", "team", "service.instance.id"). + "resource": map[string]any{ + // "service.instance.id": config.Env("APP_INSTANCE_ID", ""), + }, + + // Context Propagation + // + // Defines how trace context is encoded and propagated across process + // boundaries (e.g., HTTP headers). + // + // Supported: + // - "tracecontext": W3C Trace Context (Standard) + // - "baggage": W3C Baggage + // - "b3": B3 Single Header (Zipkin) + // - "b3multi": B3 Multi Header + "propagators": config.Env("OTEL_PROPAGATORS", "tracecontext"), + + // Traces Configuration + // + // Configures the distributed tracing signal. Traces record the path of + // a request as it propagates through the distributed system. + "traces": map[string]any{ + // Exporter + // + // The name of the exporter definition in the "exporters" section below. + // Set to "" to disable tracing. + "exporter": config.Env("OTEL_TRACES_EXPORTER", "otlptrace"), + + // Sampler Configuration + // + // Controls which traces are recorded and exported. Sampling reduces + // overhead and storage costs by only recording a subset of traces. + "sampler": map[string]any{ + // If true, respects the sampling decision of the upstream service. + "parent": config.Env("OTEL_TRACES_SAMPLER_PARENT", true), + + // Sampling Strategy: + // - "always_on": Record every trace (Dev/Test). + // - "always_off": Record nothing. + // - "traceidratio": Probabilistic sampling based on the ratio. + "type": config.Env("OTEL_TRACES_SAMPLER_TYPE", "always_on"), + + // The ratio for "traceidratio" sampling (0.0 to 1.0). + // e.g., 0.1 records ~10% of traces. + "ratio": config.Env("OTEL_TRACES_SAMPLER_RATIO", 0.05), + }, + }, + + // Metrics Configuration + // + // Configures the metric signal. Metrics are numerical data points + // aggregated over time (e.g., request counters, memory usage). + "metrics": map[string]any{ + // Exporter + // + // The name of the exporter definition in the "exporters" section below. + // Set to "" to disable metrics. + "exporter": config.Env("OTEL_METRICS_EXPORTER", "otlpmetric"), + + // Reader Configuration + // + // Configures the PeriodicReader, which collects and pushes metrics + // to the exporter at a fixed interval. + "reader": map[string]any{ + // Interval: How often metrics are pushed. + // Format: Duration string (e.g., "60s", "1m", "500ms"). + "interval": config.Env("OTEL_METRIC_EXPORT_INTERVAL", "60s"), + + // Timeout: Max time allowed for export before cancelling. + // Format: Duration string (e.g., "30s", "10s"). + "timeout": config.Env("OTEL_METRIC_EXPORT_TIMEOUT", "30s"), + }, + }, + + // Logs Configuration + // + // Configures the logging signal. Logs are textual records of events + // linked to traces for correlation. + "logs": map[string]any{ + // Exporter + // + // The name of the exporter definition in the "exporters" section below. + // Set to "" to disable OTel logging. + "exporter": config.Env("OTEL_LOGS_EXPORTER", "otlplog"), + + // Processor Configuration + // + // Configures the BatchLogProcessor, which batches logs before export. + "processor": map[string]any{ + // Interval: How often logs are flushed. + // Format: Duration string (e.g., "1s", "500ms"). + "interval": config.Env("OTEL_LOG_EXPORT_INTERVAL", "1s"), + + // Timeout: Max time allowed for export before cancelling. + // Format: Duration string (e.g., "30s"). + "timeout": config.Env("OTEL_LOG_EXPORT_TIMEOUT", "30s"), + }, + }, + + // Exporters Configuration + // + // Defines the details for connecting to external telemetry backends. + // These definitions are referenced by name in the signal sections above. + // + // Supported drivers: "otlp", "zipkin", "console", "custom" + "exporters": map[string]any{ + // OTLP Trace Exporter + // Reference: https://opentelemetry.io/docs/specs/otel/protocol/ + "otlptrace": map[string]any{ + "driver": "otlp", + "endpoint": config.Env("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", "http://localhost:4318"), + + // Protocol: "http/protobuf", "http/json" or "grpc". + "protocol": config.Env("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", "http/protobuf"), + + // Set to false to require TLS/SSL. + "insecure": config.Env("OTEL_EXPORTER_OTLP_TRACES_INSECURE", true), + + // Timeout: Max time to wait for the backend to acknowledge. + // Format: Duration string (e.g., "10s", "500ms"). + "timeout": config.Env("OTEL_EXPORTER_OTLP_TRACES_TIMEOUT", "10s"), + }, + + // OTLP Metric Exporter + "otlpmetric": map[string]any{ + "driver": "otlp", + "endpoint": config.Env("OTEL_EXPORTER_OTLP_METRICS_ENDPOINT", "http://localhost:4318"), + "protocol": config.Env("OTEL_EXPORTER_OTLP_METRICS_PROTOCOL", "http/protobuf"), + "insecure": config.Env("OTEL_EXPORTER_OTLP_METRICS_INSECURE", true), + + // Timeout: Max time to wait for the backend to acknowledge. + // Format: Duration string (e.g., "10s", "500ms"). + "timeout": config.Env("OTEL_EXPORTER_OTLP_METRICS_TIMEOUT", "10s"), + + // Metric Temporality: "cumulative" or "delta". + // - "cumulative": Standard for Prometheus (counts never reset). + // - "delta": Standard for Datadog/StatsD (counts per interval). + "metric_temporality": config.Env("OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY", "cumulative"), + }, + + // OTLP Log Exporter + "otlplog": map[string]any{ + "driver": "otlp", + "endpoint": config.Env("OTEL_EXPORTER_OTLP_LOGS_ENDPOINT", "http://localhost:4318"), + "protocol": config.Env("OTEL_EXPORTER_OTLP_LOGS_PROTOCOL", "http/protobuf"), + "insecure": config.Env("OTEL_EXPORTER_OTLP_LOGS_INSECURE", true), + + // Timeout: Max time to wait for the backend to acknowledge. + // Format: Duration string (e.g., "10s", "500ms"). + "timeout": config.Env("OTEL_EXPORTER_OTLP_LOGS_TIMEOUT", "10s"), + }, + + // Zipkin Trace Exporter (Tracing only) + "zipkin": map[string]any{ + "driver": "zipkin", + "endpoint": config.Env("OTEL_EXPORTER_ZIPKIN_ENDPOINT", "http://localhost:9411/api/v2/spans"), + }, + + // Console Exporter (Debugging) + // Prints telemetry data to stdout. + "console": map[string]any{ + "driver": "console", + }, + }, + }) +} diff --git a/database/migrations/20210101000001_create_users_table.go b/database/migrations/20210101000001_create_users_table.go index 41c385b..90ddaee 100644 --- a/database/migrations/20210101000001_create_users_table.go +++ b/database/migrations/20210101000001_create_users_table.go @@ -1,8 +1,9 @@ package migrations import ( + "goravel/app/facades" + "github.com/goravel/framework/contracts/database/schema" - "github.com/goravel/framework/facades" ) type M20210101000001CreateUsersTable struct { diff --git a/database/migrations/20210101000002_create_jobs_table.go b/database/migrations/20210101000002_create_jobs_table.go index 6af47a7..a3901c2 100644 --- a/database/migrations/20210101000002_create_jobs_table.go +++ b/database/migrations/20210101000002_create_jobs_table.go @@ -1,8 +1,9 @@ package migrations import ( + "goravel/app/facades" + "github.com/goravel/framework/contracts/database/schema" - "github.com/goravel/framework/facades" ) type M20210101000002CreateJobsTable struct{} diff --git a/database/migrations/20250330911908_add_columns_to_users_table.go b/database/migrations/20250330911908_add_columns_to_users_table.go index 036a65c..8542602 100755 --- a/database/migrations/20250330911908_add_columns_to_users_table.go +++ b/database/migrations/20250330911908_add_columns_to_users_table.go @@ -1,8 +1,9 @@ package migrations import ( + "goravel/app/facades" + "github.com/goravel/framework/contracts/database/schema" - "github.com/goravel/framework/facades" ) type M20250330911908AddColumnsToUsersTable struct{} diff --git a/database/migrations/20250331093125_alert_columns_of_users_table.go b/database/migrations/20250331093125_alert_columns_of_users_table.go index 8c6a141..f312c10 100755 --- a/database/migrations/20250331093125_alert_columns_of_users_table.go +++ b/database/migrations/20250331093125_alert_columns_of_users_table.go @@ -1,8 +1,9 @@ package migrations import ( + "goravel/app/facades" + "github.com/goravel/framework/contracts/database/schema" - "github.com/goravel/framework/facades" ) type M20250331093125AlertColumnsOfUsersTable struct{} diff --git a/go.mod b/go.mod index e6cffc3..d4b0700 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/goravel/cos v1.4.0 github.com/goravel/example-proto v0.0.1 github.com/goravel/fiber v1.4.1-0.20251109040651-b6c661b58190 - github.com/goravel/framework v1.16.1-0.20251109075227-ffe30d208f56 + github.com/goravel/framework v1.16.1-0.20251230134041-fade7235c640 github.com/goravel/gin v1.4.1-0.20251109031702-b35766bf8aa3 github.com/goravel/minio v1.4.0 github.com/goravel/mysql v1.4.0 @@ -30,7 +30,7 @@ require ( github.com/swaggo/swag v1.16.2 github.com/uber/jaeger-client-go v2.30.0+incompatible github.com/vektah/gqlparser/v2 v2.5.19 - google.golang.org/grpc v1.76.0 + google.golang.org/grpc v1.78.0 ) require ( @@ -62,12 +62,13 @@ require ( github.com/bytedance/sonic v1.14.0 // indirect github.com/bytedance/sonic/loader v0.3.0 // indirect github.com/catppuccin/go v0.3.0 // indirect + github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/charmbracelet/bubbles v0.21.1-0.20250623103423-23b8fd6302d7 // indirect github.com/charmbracelet/bubbletea v1.3.10 // indirect github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect github.com/charmbracelet/huh v0.8.0 // indirect - github.com/charmbracelet/huh/spinner v0.0.0-20251005153135-a01a1e304532 // indirect + github.com/charmbracelet/huh/spinner v0.0.0-20251215014908-6f7d32faaff3 // indirect github.com/charmbracelet/lipgloss v1.1.0 // indirect github.com/charmbracelet/x/ansi v0.10.1 // indirect github.com/charmbracelet/x/cellbuf v0.0.13 // indirect @@ -84,9 +85,11 @@ require ( github.com/dustin/go-humanize v1.0.1 // indirect github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect - github.com/gabriel-vasile/mimetype v1.4.11 // indirect + github.com/gabriel-vasile/mimetype v1.4.12 // indirect github.com/gin-contrib/sse v1.1.0 // indirect github.com/go-ini/ini v1.67.0 // indirect + github.com/go-logr/logr v1.4.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/jsonpointer v0.20.2 // indirect github.com/go-openapi/jsonreference v0.20.4 // indirect github.com/go-openapi/spec v0.20.14 // indirect @@ -100,7 +103,7 @@ require ( github.com/goccy/go-yaml v1.18.0 // indirect github.com/gofiber/template v1.8.3 // indirect github.com/gofiber/utils v1.1.0 // indirect - github.com/goforj/godump v1.6.0 // indirect + github.com/goforj/godump v1.9.0 // indirect github.com/golang-jwt/jwt/v5 v5.3.0 // indirect github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect github.com/golang-sql/sqlexp v0.1.0 // indirect @@ -112,6 +115,7 @@ require ( github.com/gookit/goutil v0.7.1 // indirect github.com/gookit/validate v1.5.6 // indirect github.com/goravel/file-rotatelogs/v2 v2.4.2 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect @@ -148,6 +152,7 @@ require ( github.com/ncruces/go-sqlite3 v0.25.0 // indirect github.com/ncruces/go-sqlite3/gormlite v0.24.0 // indirect github.com/ncruces/julianday v1.0.0 // indirect + github.com/openzipkin/zipkin-go v0.4.3 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/philhofer/fwd v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -155,7 +160,6 @@ require ( github.com/quic-go/qpack v0.5.1 // indirect github.com/quic-go/quic-go v0.54.0 // indirect github.com/redis/go-redis/v9 v9.16.0 // indirect - github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/robfig/cron/v3 v3.0.1 // indirect github.com/rotisserie/eris v0.5.4 // indirect @@ -163,7 +167,8 @@ require ( github.com/rs/xid v1.6.0 // indirect github.com/sagikazarmark/locafero v0.11.0 // indirect github.com/samber/lo v1.52.0 // indirect - github.com/sirupsen/logrus v1.9.3 // indirect + github.com/samber/slog-common v0.19.0 // indirect + github.com/samber/slog-multi v1.6.0 // indirect github.com/sosodev/duration v1.3.1 // indirect github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect github.com/spf13/afero v1.15.0 // indirect @@ -179,27 +184,49 @@ require ( github.com/uber/jaeger-lib v2.4.1+incompatible // indirect github.com/ugorji/go/codec v1.3.0 // indirect github.com/unrolled/secure v1.17.0 // indirect - github.com/urfave/cli/v3 v3.5.0 // indirect + github.com/urfave/cli/v3 v3.6.1 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasthttp v1.68.0 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 // indirect + go.opentelemetry.io/auto/sdk v1.2.1 // indirect + go.opentelemetry.io/contrib/propagators/b3 v1.39.0 // indirect + go.opentelemetry.io/otel v1.39.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.15.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.15.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.39.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.39.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.39.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.39.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.39.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.15.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.39.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.39.0 // indirect + go.opentelemetry.io/otel/exporters/zipkin v1.39.0 // indirect + go.opentelemetry.io/otel/log v0.15.0 // indirect + go.opentelemetry.io/otel/metric v1.39.0 // indirect + go.opentelemetry.io/otel/sdk v1.39.0 // indirect + go.opentelemetry.io/otel/sdk/log v0.15.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.39.0 // indirect + go.opentelemetry.io/otel/trace v1.39.0 // indirect + go.opentelemetry.io/proto/otlp v1.9.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/mock v0.5.0 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/arch v0.20.0 // indirect - golang.org/x/crypto v0.43.0 // indirect - golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 // indirect - golang.org/x/mod v0.29.0 // indirect - golang.org/x/net v0.46.0 // indirect - golang.org/x/sync v0.17.0 // indirect - golang.org/x/sys v0.37.0 // indirect - golang.org/x/term v0.36.0 // indirect - golang.org/x/text v0.30.0 // indirect + golang.org/x/crypto v0.46.0 // indirect + golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 // indirect + golang.org/x/mod v0.31.0 // indirect + golang.org/x/net v0.48.0 // indirect + golang.org/x/sync v0.19.0 // indirect + golang.org/x/sys v0.39.0 // indirect + golang.org/x/term v0.38.0 // indirect + golang.org/x/text v0.32.0 // indirect golang.org/x/time v0.12.0 // indirect - golang.org/x/tools v0.38.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b // indirect - google.golang.org/protobuf v1.36.10 // indirect + golang.org/x/tools v0.40.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect + google.golang.org/protobuf v1.36.11 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gorm.io/driver/mysql v1.6.0 // indirect gorm.io/driver/postgres v1.6.0 // indirect @@ -207,5 +234,3 @@ require ( gorm.io/gorm v1.31.1 // indirect gorm.io/plugin/dbresolver v1.6.2 // indirect ) - -replace github.com/goravel/framework => github.com/goravel/framework v1.16.1-0.20251109075227-ffe30d208f56 diff --git a/go.sum b/go.sum index 0481fb3..366037d 100644 --- a/go.sum +++ b/go.sum @@ -101,8 +101,8 @@ github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiE github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/aymanbagabas/go-udiff v0.3.1 h1:LV+qyBQ2pqe0u42ZsUEtPiCaUoqgA9gYRDs3vj1nolY= github.com/aymanbagabas/go-udiff v0.3.1/go.mod h1:G0fsKmG+P6ylD0r6N/KgQD/nWzgfnl8ZBcNLgcbrw8E= -github.com/brianvoe/gofakeit/v7 v7.8.2 h1:FWxoSP4Ss9LWSvTOrWZHz7sIHcpZwLVw2xa/DhJABB4= -github.com/brianvoe/gofakeit/v7 v7.8.2/go.mod h1:QXuPeBw164PJCzCUZVmgpgHJ3Llj49jSLVkKPMtxtxA= +github.com/brianvoe/gofakeit/v7 v7.14.0 h1:R8tmT/rTDJmD2ngpqBL9rAKydiL7Qr2u3CXPqRt59pk= +github.com/brianvoe/gofakeit/v7 v7.14.0/go.mod h1:QXuPeBw164PJCzCUZVmgpgHJ3Llj49jSLVkKPMtxtxA= github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= @@ -113,6 +113,8 @@ github.com/bytedance/sonic/loader v0.3.0 h1:dskwH8edlzNMctoruo8FPTJDF3vLtDT0sXZw github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= github.com/catppuccin/go v0.3.0 h1:d+0/YicIq+hSTo5oPuRi5kOpqkVA5tAsU6dNhvRu+aY= github.com/catppuccin/go v0.3.0/go.mod h1:8IHJuMGaUUjQM82qBrGNBv7LFq6JI3NnQCF6MOlZjpc= +github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= +github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/charmbracelet/bubbles v0.21.1-0.20250623103423-23b8fd6302d7 h1:JFgG/xnwFfbezlUnFMJy0nusZvytYysV4SCS2cYbvws= @@ -123,8 +125,8 @@ github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4p github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk= github.com/charmbracelet/huh v0.8.0 h1:Xz/Pm2h64cXQZn/Jvele4J3r7DDiqFCNIVteYukxDvY= github.com/charmbracelet/huh v0.8.0/go.mod h1:5YVc+SlZ1IhQALxRPpkGwwEKftN/+OlJlnJYlDRFqN4= -github.com/charmbracelet/huh/spinner v0.0.0-20251005153135-a01a1e304532 h1:iw1MJ8sBSnXQD50VwYaTM8I2P+kWw+X2RLPH5HHd1v0= -github.com/charmbracelet/huh/spinner v0.0.0-20251005153135-a01a1e304532/go.mod h1:OMqKat/mm9a/qOnpuNOPyYO9bPzRNnmzLnRZT5KYltg= +github.com/charmbracelet/huh/spinner v0.0.0-20251215014908-6f7d32faaff3 h1:KUeWGoKnmyrLaDIa0smE6pK5eFMZWNIxPGweQR12iLg= +github.com/charmbracelet/huh/spinner v0.0.0-20251215014908-6f7d32faaff3/go.mod h1:OMqKat/mm9a/qOnpuNOPyYO9bPzRNnmzLnRZT5KYltg= github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY= github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30= github.com/charmbracelet/x/ansi v0.10.1 h1:rL3Koar5XvX0pHGfovN03f5cxLbCF2YvLeyz7D2jVDQ= @@ -182,8 +184,8 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= -github.com/gabriel-vasile/mimetype v1.4.11 h1:AQvxbp830wPhHTqc1u7nzoLT+ZFxGY7emj5DR5DYFik= -github.com/gabriel-vasile/mimetype v1.4.11/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s= +github.com/gabriel-vasile/mimetype v1.4.12 h1:e9hWvmLYvtp846tLHam2o++qitpguFiYCKbn0w9jyqw= +github.com/gabriel-vasile/mimetype v1.4.12/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s= github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w= github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM= github.com/gin-gonic/gin v1.11.0 h1:OW/6PLjyusp2PPXtyxKHU0RbX6I/l28FTdDlae5ueWk= @@ -191,6 +193,7 @@ github.com/gin-gonic/gin v1.11.0/go.mod h1:+iq/FyxlGzII0KHiBGjuNn4UNENUlKbGlNmc+ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= @@ -228,8 +231,8 @@ github.com/gofiber/template/html/v2 v2.1.3 h1:n1LYBtmr9C0V/k/3qBblXyMxV5B0o/gpb6 github.com/gofiber/template/html/v2 v2.1.3/go.mod h1:U5Fxgc5KpyujU9OqKzy6Kn6Qup6Tm7zdsISR+VpnHRE= github.com/gofiber/utils v1.1.0 h1:vdEBpn7AzIUJRhe+CiTOJdUcTg4Q9RK+pEa0KPbLdrM= github.com/gofiber/utils v1.1.0/go.mod h1:poZpsnhBykfnY1Mc0KeEa6mSHrS3dV0+oBWyeQmb2e0= -github.com/goforj/godump v1.6.0 h1:3Dn8gaw5Xxxefr1ezTGTWrTKSr3ihK+eJ2xzRUoFfHQ= -github.com/goforj/godump v1.6.0/go.mod h1:/Vy+p50JtOkwsFN5dA1HQ7LS5gtPk3f61DaP4UR2o4s= +github.com/goforj/godump v1.9.0 h1:Y/APfWKQKnJetXgVJxDqD7vEpTGSgAwbKJGmj0UAteI= +github.com/goforj/godump v1.9.0/go.mod h1:/Vy+p50JtOkwsFN5dA1HQ7LS5gtPk3f61DaP4UR2o4s= github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= @@ -276,8 +279,8 @@ github.com/goravel/fiber v1.4.1-0.20251109040651-b6c661b58190 h1:Q2rtE7r8M4hkVHZ github.com/goravel/fiber v1.4.1-0.20251109040651-b6c661b58190/go.mod h1:saOGAbRxtjrW+th8K/bYzrKK8WhvD4wxs7ncUstl5Lg= github.com/goravel/file-rotatelogs/v2 v2.4.2 h1:g68AzbePXcm0V2CpUMc9j4qVzcDn7+7aoWSjZ51C0m4= github.com/goravel/file-rotatelogs/v2 v2.4.2/go.mod h1:23VuSW8cBS4ax5cmbV+5AaiLpq25b8UJ96IhbAkdo8I= -github.com/goravel/framework v1.16.1-0.20251109075227-ffe30d208f56 h1:UX1nNz5mvMh/pOMGGn3glXEUuggBNWApiRij/Ivstf4= -github.com/goravel/framework v1.16.1-0.20251109075227-ffe30d208f56/go.mod h1:jlAceXNhpeKURYGfjy8XoUqH/GOij1uYo1Ur9h3UDaI= +github.com/goravel/framework v1.16.1-0.20251230134041-fade7235c640 h1:yDf1PYuskrGVsONDGk+PcOuzvXL7+/p6hu8KGu11FMs= +github.com/goravel/framework v1.16.1-0.20251230134041-fade7235c640/go.mod h1:KIFF13g3DyluGXYAznGRt1DWhvczCAPNv4E62pyE6EA= github.com/goravel/gin v1.4.1-0.20251109031702-b35766bf8aa3 h1:K+bN9hZfN0Ia9DkaZCYdwSkqKLmgENXyPEX9RZFKLTw= github.com/goravel/gin v1.4.1-0.20251109031702-b35766bf8aa3/go.mod h1:x1PpRCCTO7IZQ/qvLY0OhSmfcDGZDs7oGqHQngLpwNA= github.com/goravel/minio v1.4.0 h1:WBs6QsN//2Q3sjguzyb1aC/BD6tdFXI3q9GYIjlffzc= @@ -300,6 +303,8 @@ github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+ github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 h1:NmZ1PKzSTQbuGHw9DGPFomqkkLWMC+vZCkfs+FHv1Vg= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3/go.mod h1:zQrxl1YP88HQlA6i9c63DSVPFklWpGX4OWAc9bFuaH4= github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= @@ -413,6 +418,8 @@ github.com/ncruces/julianday v1.0.0/go.mod h1:Dusn2KvZrrovOMJuOt0TNXL6tB7U2E8kvz github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= +github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7sjsSdg= +github.com/openzipkin/zipkin-go v0.4.3/go.mod h1:M9wCJZFWCo2RiY+o1eBCEMe0Dp2S5LDHcMZmk3RmK7c= github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM= @@ -441,8 +448,6 @@ github.com/quic-go/quic-go v0.54.0 h1:6s1YB9QotYI6Ospeiguknbp2Znb/jZYjZLRXn9kMQB github.com/quic-go/quic-go v0.54.0/go.mod h1:e68ZEaCdyviluZmy44P6Iey98v/Wfz6HCjQEm+l8zTY= github.com/redis/go-redis/v9 v9.16.0 h1:OotgqgLSRCmzfqChbQyG1PHC3tLNR89DG4jdOERSEP4= github.com/redis/go-redis/v9 v9.16.0/go.mod h1:u410H11HMLoB+TP67dz8rL9s6QW2j76l0//kSOd3370= -github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 h1:mZHayPoR0lNmnHyvtYjDeq0zlVHn9K/ZXoy17ylucdo= -github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5/go.mod h1:GEXHk5HgEKCvEIIrSpFI3ozzG5xOKA2DVlEX/gGnewM= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= @@ -450,8 +455,8 @@ github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= -github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= -github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/rotisserie/eris v0.5.4 h1:Il6IvLdAapsMhvuOahHWiBnl1G++Q0/L5UIkI5mARSk= github.com/rotisserie/eris v0.5.4/go.mod h1:Z/kgYTJiJtocxCbFfvRmO+QejApzG6zpyky9G1A4g9s= github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= @@ -463,11 +468,13 @@ github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDc github.com/sagikazarmark/locafero v0.11.0/go.mod h1:nVIGvgyzw595SUSUE6tvCp3YYTeHs15MvlmU87WwIik= github.com/samber/lo v1.52.0 h1:Rvi+3BFHES3A8meP33VPAxiBZX/Aws5RxrschYGjomw= github.com/samber/lo v1.52.0/go.mod h1:4+MXEGsJzbKGaUEQFKBq2xtfuznW9oz/WrgyzMzRoM0= +github.com/samber/slog-common v0.19.0 h1:fNcZb8B2uOLooeYwFpAlKjkQTUafdjfqKcwcC89G9YI= +github.com/samber/slog-common v0.19.0/go.mod h1:dTz+YOU76aH007YUU0DffsXNsGFQRQllPQh9XyNoA3M= +github.com/samber/slog-multi v1.6.0 h1:i1uBY+aaln6ljwdf7Nrt4Sys8Kk6htuYuXDHWJsHtZg= +github.com/samber/slog-multi v1.6.0/go.mod h1:qTqzmKdPpT0h4PFsTN5rYRgLwom1v+fNGuIrl1Xnnts= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= -github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= -github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sosodev/duration v1.3.1 h1:qtHBDMQ6lvMQsL15g4aopM4HEfOaYuhWBw3NPTtlqq4= github.com/sosodev/duration v1.3.1/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw= @@ -524,8 +531,8 @@ github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4= github.com/unrolled/secure v1.17.0 h1:Io7ifFgo99Bnh0J7+Q+qcMzWM6kaDPCA5FroFZEdbWU= github.com/unrolled/secure v1.17.0/go.mod h1:BmF5hyM6tXczk3MpQkFf1hpKSRqCyhqcbiQtiAF7+40= -github.com/urfave/cli/v3 v3.5.0 h1:qCuFMmdayTF3zmjG8TSsoBzrDqszNrklYg2x3g4MSgw= -github.com/urfave/cli/v3 v3.5.0/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso= +github.com/urfave/cli/v3 v3.6.1 h1:j8Qq8NyUawj/7rTYdBGrxcH7A/j7/G8Q5LhWEW4G3Mo= +github.com/urfave/cli/v3 v3.6.1/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.68.0 h1:v12Nx16iepr8r9ySOwqI+5RBJ/DqTxhOy1HrHoDFnok= @@ -540,20 +547,56 @@ github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342/go.mod h1:Ohn+xnUBi github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU= github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= -go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= -go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/sdk/metric v1.37.0 h1:90lI228XrB9jCMuSdA0673aubgRobVZFhbjxHHspCPc= -go.opentelemetry.io/otel/sdk/metric v1.37.0/go.mod h1:cNen4ZWfiD37l5NhS+Keb5RXVWZWpRE+9WyVCpbo5ps= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= +go.opentelemetry.io/contrib/propagators/b3 v1.39.0 h1:PI7pt9pkSnimWcp5sQhUA9OzLbc3Ba4sL+VEUTNsxrk= +go.opentelemetry.io/contrib/propagators/b3 v1.39.0/go.mod h1:5gV/EzPnfYIwjzj+6y8tbGW2PKWhcsz5e/7twptRVQY= +go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48= +go.opentelemetry.io/otel v1.39.0/go.mod h1:kLlFTywNWrFyEdH0oj2xK0bFYZtHRYUdv1NklR/tgc8= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.15.0 h1:W+m0g+/6v3pa5PgVf2xoFMi5YtNR06WtS7ve5pcvLtM= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.15.0/go.mod h1:JM31r0GGZ/GU94mX8hN4D8v6e40aFlUECSQ48HaLgHM= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.15.0 h1:EKpiGphOYq3CYnIe2eX9ftUkyU+Y8Dtte8OaWyHJ4+I= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.15.0/go.mod h1:nWFP7C+T8TygkTjJ7mAyEaFaE7wNfms3nV/vexZ6qt0= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.39.0 h1:cEf8jF6WbuGQWUVcqgyWtTR0kOOAWY1DYZ+UhvdmQPw= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.39.0/go.mod h1:k1lzV5n5U3HkGvTCJHraTAGJ7MqsgL1wrGwTj1Isfiw= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.39.0 h1:nKP4Z2ejtHn3yShBb+2KawiXgpn8In5cT7aO2wXuOTE= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.39.0/go.mod h1:NwjeBbNigsO4Aj9WgM0C+cKIrxsZUaRmZUO7A8I7u8o= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.39.0 h1:f0cb2XPmrqn4XMy9PNliTgRKJgS5WcL/u0/WRYGz4t0= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.39.0/go.mod h1:vnakAaFckOMiMtOIhFI2MNH4FYrZzXCYxmb1LlhoGz8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.39.0 h1:in9O8ESIOlwJAEGTkkf34DesGRAc/Pn8qJ7k3r/42LM= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.39.0/go.mod h1:Rp0EXBm5tfnv0WL+ARyO/PHBEaEAT8UUHQ6AGJcSq6c= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.39.0 h1:Ckwye2FpXkYgiHX7fyVrN1uA/UYd9ounqqTuSNAv0k4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.39.0/go.mod h1:teIFJh5pW2y+AN7riv6IBPX2DuesS3HgP39mwOspKwU= +go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.15.0 h1:0BSddrtQqLEylcErkeFrJBmwFzcqfQq9+/uxfTZq+HE= +go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.15.0/go.mod h1:87sjYuAPzaRCtdd09GU5gM1U9wQLrrcYrm77mh5EBoc= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.39.0 h1:5gn2urDL/FBnK8OkCfD1j3/ER79rUuTYmCvlXBKeYL8= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.39.0/go.mod h1:0fBG6ZJxhqByfFZDwSwpZGzJU671HkwpWaNe2t4VUPI= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.39.0 h1:8UPA4IbVZxpsD76ihGOQiFml99GPAEZLohDXvqHdi6U= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.39.0/go.mod h1:MZ1T/+51uIVKlRzGw1Fo46KEWThjlCBZKl2LzY5nv4g= +go.opentelemetry.io/otel/exporters/zipkin v1.39.0 h1:zas8I6MeDWD5rxJmkXcCPRnpvNtZHkENiTkX/eJlycg= +go.opentelemetry.io/otel/exporters/zipkin v1.39.0/go.mod h1:SmFF1H2pTNFFvD4NqRanxPP8W+8KjTgFJhJQi3C6Co0= +go.opentelemetry.io/otel/log v0.15.0 h1:0VqVnc3MgyYd7QqNVIldC3dsLFKgazR6P3P3+ypkyDY= +go.opentelemetry.io/otel/log v0.15.0/go.mod h1:9c/G1zbyZfgu1HmQD7Qj84QMmwTp2QCQsZH1aeoWDE4= +go.opentelemetry.io/otel/log/logtest v0.15.0 h1:porNFuxAjodl6LhePevOc3n7bo3Wi3JhGXNWe7KP8iU= +go.opentelemetry.io/otel/log/logtest v0.15.0/go.mod h1:c8epqBXGHgS1LiNgmD+LuNYK9lSS3mqvtMdxLsfJgLg= +go.opentelemetry.io/otel/metric v1.39.0 h1:d1UzonvEZriVfpNKEVmHXbdf909uGTOQjA0HF0Ls5Q0= +go.opentelemetry.io/otel/metric v1.39.0/go.mod h1:jrZSWL33sD7bBxg1xjrqyDjnuzTUB0x1nBERXd7Ftcs= +go.opentelemetry.io/otel/sdk v1.39.0 h1:nMLYcjVsvdui1B/4FRkwjzoRVsMK8uL/cj0OyhKzt18= +go.opentelemetry.io/otel/sdk v1.39.0/go.mod h1:vDojkC4/jsTJsE+kh+LXYQlbL8CgrEcwmt1ENZszdJE= +go.opentelemetry.io/otel/sdk/log v0.15.0 h1:WgMEHOUt5gjJE93yqfqJOkRflApNif84kxoHWS9VVHE= +go.opentelemetry.io/otel/sdk/log v0.15.0/go.mod h1:qDC/FlKQCXfH5hokGsNg9aUBGMJQsrUyeOiW5u+dKBQ= +go.opentelemetry.io/otel/sdk/log/logtest v0.14.0 h1:Ijbtz+JKXl8T2MngiwqBlPaHqc4YCaP/i13Qrow6gAM= +go.opentelemetry.io/otel/sdk/log/logtest v0.14.0/go.mod h1:dCU8aEL6q+L9cYTqcVOk8rM9Tp8WdnHOPLiBgp0SGOA= +go.opentelemetry.io/otel/sdk/metric v1.39.0 h1:cXMVVFVgsIf2YL6QkRF4Urbr/aMInf+2WKg+sEJTtB8= +go.opentelemetry.io/otel/sdk/metric v1.39.0/go.mod h1:xq9HEVH7qeX69/JnwEfp6fVq5wosJsY1mt4lLfYdVew= +go.opentelemetry.io/otel/trace v1.39.0 h1:2d2vfpEDmCJ5zVYz7ijaJdOF59xLomrvj7bjt6/qCJI= +go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4EtqqlVdxWy+rNOA= +go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A= +go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= @@ -573,15 +616,15 @@ golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOM golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= -golang.org/x/crypto v0.43.0 h1:dduJYIi3A3KOfdGOHX8AVZ/jGiyPa3IbBozJ5kNuE04= -golang.org/x/crypto v0.43.0/go.mod h1:BFbav4mRNlXJL4wNeejLpWxB7wMbc79PdRGhWKncxR0= +golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU= +golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 h1:mgKeJMpvi0yx/sU5GsxQ7p6s2wtOnGAHZWCHUM4KGzY= -golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546/go.mod h1:j/pmGrbnkbPtQfxEe5D0VQhZC6qKbfKifgD0oM7sR70= +golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 h1:fQsdNF2N+/YewlRZiricy4P1iimyPKZ/xwniHj8Q2a0= +golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93/go.mod h1:EPRbTFwzwjXj9NpYyyrvenVh9Y+GFeEvMNh7Xuz7xgU= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= @@ -593,8 +636,8 @@ golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA= -golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w= +golang.org/x/mod v0.31.0 h1:HaW9xtz0+kOcWKwli0ZXy79Ix+UW/vOfmWI5QVd2tgI= +golang.org/x/mod v0.31.0/go.mod h1:43JraMp9cGx1Rx3AqioxrbrhNsLl2l/iNAvuBkrezpg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -613,8 +656,8 @@ golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= -golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4= -golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210= +golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU= +golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -622,8 +665,8 @@ golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= -golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= +golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -636,7 +679,6 @@ golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -651,8 +693,8 @@ golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= -golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= +golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -670,8 +712,8 @@ golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= -golang.org/x/term v0.36.0 h1:zMPR+aF8gfksFprF/Nc/rd1wRS1EI6nDBGyWAvDzx2Q= -golang.org/x/term v0.36.0/go.mod h1:Qu394IJq6V6dCBRgwqshf3mPF85AqzYEzofzRdZkWss= +golang.org/x/term v0.38.0 h1:PQ5pkm/rLO6HnxFR7N2lJHOZX6Kez5Y1gDSJla6jo7Q= +golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= @@ -685,8 +727,8 @@ golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= -golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k= -golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM= +golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU= +golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY= golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE= golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -698,8 +740,8 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= -golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ= -golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs= +golang.org/x/tools v0.40.0 h1:yLkxfA+Qnul4cs9QA3KnlFu0lVmd8JJfoq+E41uSutA= +golang.org/x/tools v0.40.0/go.mod h1:Ik/tzLRlbscWpqqMRjyWYDisX8bG13FrdXp3o4Sr9lc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -709,12 +751,14 @@ gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b h1:zPKJod4w6F1+nRGDI9ubnXYhU9NSWoFAijkHkUXeTK8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= -google.golang.org/grpc v1.76.0 h1:UnVkv1+uMLYXoIz6o7chp59WfQUYA2ex/BXQ9rHZu7A= -google.golang.org/grpc v1.76.0/go.mod h1:Ju12QI8M6iQJtbcsV+awF5a4hfJMLi4X0JLo94ULZ6c= -google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= -google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 h1:fCvbg86sFXwdrl5LgVcTEvNC+2txB5mgROGmRL5mrls= +google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:+rXWjjaukWZun3mLfjmVnQi18E1AsFbDN9QdJ5YXLto= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= +google.golang.org/grpc v1.78.0 h1:K1XZG/yGDJnzMdd/uZHAkVqJE+xIDOcmdSFZkBUicNc= +google.golang.org/grpc v1.78.0/go.mod h1:I47qjTo4OKbMkjA/aOOwxDIiPSBofUtQUI5EfpWvW7U= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/main.go b/main.go index 32c319f..cdd38ba 100644 --- a/main.go +++ b/main.go @@ -5,7 +5,7 @@ import ( "os/signal" "syscall" - "github.com/goravel/framework/facades" + "goravel/app/facades" "goravel/bootstrap" ) diff --git a/package_test.go b/package_test.go index 760747e..967db56 100644 --- a/package_test.go +++ b/package_test.go @@ -3,8 +3,9 @@ package main import ( "testing" + "goravel/app/facades" + "github.com/goravel/framework/contracts/foundation" - "github.com/goravel/framework/facades" "github.com/goravel/framework/support/file" "github.com/goravel/framework/support/path" "github.com/stretchr/testify/assert" diff --git a/packages/sms/setup/config/sms.go b/packages/sms/setup/config/sms.go index f5093d4..ec27305 100755 --- a/packages/sms/setup/config/sms.go +++ b/packages/sms/setup/config/sms.go @@ -1,7 +1,7 @@ package config import ( - "github.com/goravel/framework/facades" + "goravel/app/facades" ) func init() { diff --git a/packages/sms/setup/setup.go b/packages/sms/setup/setup.go index fae4912..9cf06d8 100755 --- a/packages/sms/setup/setup.go +++ b/packages/sms/setup/setup.go @@ -10,16 +10,18 @@ import ( ) func main() { - packages.Setup(os.Args). - Install( - modify.GoFile(path.Config("app.go")). - Find(match.Imports()).Modify(modify.AddImport(packages.GetModulePath())). - Find(match.Providers()).Modify(modify.Register("&sms.ServiceProvider{}")), - ). - Uninstall( - modify.GoFile(path.Config("app.go")). - Find(match.Providers()).Modify(modify.Unregister("&sms.ServiceProvider{}")). - Find(match.Imports()).Modify(modify.RemoveImport(packages.GetModulePath())), - ). - Execute() + setup := packages.Setup(os.Args) + moduleImport := setup.Paths().Module().Import() + serviceProvider := "&sms.ServiceProvider{}" + appConfigPath := path.Config("app.go") + + setup.Install( + modify.GoFile(appConfigPath). + Find(match.Imports()).Modify(modify.AddImport(moduleImport)). + Find(match.Providers()).Modify(modify.Register(serviceProvider)), + ).Uninstall( + modify.GoFile(appConfigPath). + Find(match.Providers()).Modify(modify.Unregister(serviceProvider)). + Find(match.Imports()).Modify(modify.RemoveImport(moduleImport)), + ).Execute() } diff --git a/routes/api.go b/routes/api.go index a548eca..19a8528 100644 --- a/routes/api.go +++ b/routes/api.go @@ -3,9 +3,10 @@ package routes import ( "time" + "goravel/app/facades" + "github.com/goravel/framework/contracts/http" "github.com/goravel/framework/contracts/route" - "github.com/goravel/framework/facades" httpmiddleware "github.com/goravel/framework/http/middleware" "goravel/app/http/controllers" diff --git a/routes/graphql.go b/routes/graphql.go index ba29f06..bfd4999 100644 --- a/routes/graphql.go +++ b/routes/graphql.go @@ -4,10 +4,11 @@ import ( "goravel/graph" "goravel/graph/generated" + "goravel/app/facades" + "github.com/99designs/gqlgen/graphql/handler" "github.com/99designs/gqlgen/graphql/playground" "github.com/goravel/framework/contracts/http" - "github.com/goravel/framework/facades" ) func Graphql() { diff --git a/routes/grpc.go b/routes/grpc.go index 5f2ec1e..4f07f3e 100644 --- a/routes/grpc.go +++ b/routes/grpc.go @@ -1,8 +1,9 @@ package routes import ( + "goravel/app/facades" + proto "github.com/goravel/example-proto" - "github.com/goravel/framework/facades" "goravel/app/grpc/controllers" ) diff --git a/routes/web.go b/routes/web.go index 62e03b7..5d50ee0 100644 --- a/routes/web.go +++ b/routes/web.go @@ -1,9 +1,10 @@ package routes import ( + "goravel/app/facades" + "github.com/goravel/framework/contracts/http" "github.com/goravel/framework/contracts/route" - "github.com/goravel/framework/facades" "github.com/goravel/framework/support" "github.com/spf13/cast" diff --git a/tests/feature/db_drivers_test.go b/tests/feature/db_drivers_test.go index 528f76c..3f42802 100644 --- a/tests/feature/db_drivers_test.go +++ b/tests/feature/db_drivers_test.go @@ -3,7 +3,8 @@ package feature import ( "testing" - "github.com/goravel/framework/facades" + "goravel/app/facades" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) diff --git a/tests/feature/db_test.go b/tests/feature/db_test.go index 225fb87..41a0445 100644 --- a/tests/feature/db_test.go +++ b/tests/feature/db_test.go @@ -5,7 +5,8 @@ package feature import ( "testing" - "github.com/goravel/framework/facades" + "goravel/app/facades" + "github.com/goravel/framework/support/carbon" "github.com/stretchr/testify/suite" diff --git a/tests/feature/event_test.go b/tests/feature/event_test.go index 190802d..edec4c0 100644 --- a/tests/feature/event_test.go +++ b/tests/feature/event_test.go @@ -4,8 +4,9 @@ import ( "testing" "time" + "goravel/app/facades" + "github.com/goravel/framework/contracts/event" - "github.com/goravel/framework/facades" "github.com/stretchr/testify/assert" "goravel/app/events" diff --git a/tests/feature/fiber_test.go b/tests/feature/fiber_test.go index f9f72f1..ff17e51 100644 --- a/tests/feature/fiber_test.go +++ b/tests/feature/fiber_test.go @@ -3,7 +3,8 @@ package feature import ( "testing" - "github.com/goravel/framework/facades" + "goravel/app/facades" + "github.com/stretchr/testify/suite" ) diff --git a/tests/feature/filesystem_test.go b/tests/feature/filesystem_test.go index 9c4ff65..4650526 100644 --- a/tests/feature/filesystem_test.go +++ b/tests/feature/filesystem_test.go @@ -7,9 +7,10 @@ import ( "os" "testing" + "goravel/app/facades" + "github.com/goravel/framework/contracts/filesystem" contractsdocker "github.com/goravel/framework/contracts/testing/docker" - "github.com/goravel/framework/facades" supportdocker "github.com/goravel/framework/support/docker" testingdocker "github.com/goravel/framework/testing/docker" "github.com/minio/minio-go/v7" diff --git a/tests/feature/http_client_test.go b/tests/feature/http_client_test.go index 9c85d72..c1f851e 100644 --- a/tests/feature/http_client_test.go +++ b/tests/feature/http_client_test.go @@ -3,7 +3,8 @@ package feature import ( "testing" - "github.com/goravel/framework/facades" + "goravel/app/facades" + "github.com/stretchr/testify/suite" "goravel/tests" diff --git a/tests/feature/main_test.go b/tests/feature/main_test.go index b214b3b..9453b0f 100644 --- a/tests/feature/main_test.go +++ b/tests/feature/main_test.go @@ -5,7 +5,8 @@ import ( "testing" "time" - "github.com/goravel/framework/facades" + "goravel/app/facades" + "github.com/goravel/framework/support/file" ) diff --git a/tests/feature/migration_test.go b/tests/feature/migration_test.go index 6042adf..4f93e36 100644 --- a/tests/feature/migration_test.go +++ b/tests/feature/migration_test.go @@ -3,7 +3,8 @@ package feature import ( "testing" - "github.com/goravel/framework/facades" + "goravel/app/facades" + "github.com/goravel/mysql" "github.com/goravel/sqlite" "github.com/goravel/sqlserver" diff --git a/tests/feature/orm_test.go b/tests/feature/orm_test.go index ced874c..38986d6 100644 --- a/tests/feature/orm_test.go +++ b/tests/feature/orm_test.go @@ -3,7 +3,8 @@ package feature import ( "testing" - "github.com/goravel/framework/facades" + "goravel/app/facades" + "github.com/stretchr/testify/suite" "goravel/app/models" diff --git a/tests/feature/queue_test.go b/tests/feature/queue_test.go index 4daa651..cc7175b 100644 --- a/tests/feature/queue_test.go +++ b/tests/feature/queue_test.go @@ -5,8 +5,9 @@ import ( "testing" "time" + "goravel/app/facades" + contractsqueue "github.com/goravel/framework/contracts/queue" - "github.com/goravel/framework/facades" "github.com/goravel/framework/queue/utils" "github.com/goravel/framework/support/carbon" "github.com/stretchr/testify/suite" diff --git a/tests/feature/redis_test.go b/tests/feature/redis_test.go index c03aada..07390e6 100644 --- a/tests/feature/redis_test.go +++ b/tests/feature/redis_test.go @@ -3,8 +3,9 @@ package feature import ( "testing" + "goravel/app/facades" + "github.com/goravel/framework/contracts/queue" - "github.com/goravel/framework/facades" "github.com/stretchr/testify/suite" ) diff --git a/tests/services/main_test.go b/tests/services/main_test.go index 4934897..90f22fe 100644 --- a/tests/services/main_test.go +++ b/tests/services/main_test.go @@ -3,7 +3,8 @@ package services import ( "testing" - "github.com/goravel/framework/facades" + "goravel/app/facades" + "github.com/goravel/framework/support/file" ) From ddb45a584f41acc12f02333c3caa9ab82d5c1bcc Mon Sep 17 00:00:00 2001 From: Bowen Date: Wed, 31 Dec 2025 12:28:00 +0800 Subject: [PATCH 2/4] optimize --- .gitignore | 1 + .vscode/launch.json | 15 --------- app/grpc/controllers/user_controller.go | 3 +- app/grpc/interceptors/helper.go | 4 +-- app/http/controllers/auth_controller.go | 3 +- app/http/controllers/db_controller.go | 3 +- app/http/controllers/lang_controller.go | 4 +-- app/http/controllers/user_controller.go | 3 +- app/http/controllers/validation_controller.go | 3 +- app/http/middleware/jwt.go | 4 +-- app/http/middleware/lang.go | 4 +-- app/http/middleware/session.go | 5 ++- app/providers/auth_service_provider.go | 20 ------------ app/providers/route_service_provider.go | 31 ------------------- app/rules/exists.go | 4 +-- app/rules/not_exists.go | 4 +-- app/services/user.go | 1 - bootstrap/app.go | 23 ++++++++++++-- bootstrap/providers.go | 4 --- .../20210101000001_create_users_table.go | 4 +-- .../20210101000002_create_jobs_table.go | 4 +-- ...250330911908_add_columns_to_users_table.go | 4 +-- ...0331093125_alert_columns_of_users_table.go | 4 +-- go.mod | 2 +- go.sum | 4 +-- main.go | 1 - package_test.go | 3 +- routes/api.go | 3 +- routes/graphql.go | 9 +++--- routes/grpc.go | 3 +- routes/web.go | 3 +- tests/feature/db_drivers_test.go | 4 +-- tests/feature/db_test.go | 3 +- tests/feature/event_test.go | 3 +- tests/feature/fiber_test.go | 4 +-- tests/feature/filesystem_test.go | 6 ++-- tests/feature/http_client_test.go | 3 +- tests/feature/main_test.go | 4 +-- tests/feature/migration_test.go | 3 +- tests/feature/orm_test.go | 3 +- tests/feature/queue_test.go | 3 +- tests/feature/redis_test.go | 4 +-- tests/services/main_test.go | 4 +-- 43 files changed, 79 insertions(+), 148 deletions(-) delete mode 100644 .vscode/launch.json delete mode 100644 app/providers/auth_service_provider.go delete mode 100644 app/providers/route_service_provider.go diff --git a/.gitignore b/.gitignore index 5fe9c8e..53fa944 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea +.vscode .DS_Store .env .env.* diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 59ece5b..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Goravel", - "type": "go", - "request": "launch", - "mode": "auto", - "program": "${fileDirname}" - } - ] -} \ No newline at end of file diff --git a/app/grpc/controllers/user_controller.go b/app/grpc/controllers/user_controller.go index c12e63f..2cf31b1 100644 --- a/app/grpc/controllers/user_controller.go +++ b/app/grpc/controllers/user_controller.go @@ -4,14 +4,13 @@ import ( "context" "net/http" - "goravel/app/facades" - proto "github.com/goravel/example-proto" "github.com/goravel/framework/auth" contractshttp "github.com/goravel/framework/contracts/http" goravelhttp "github.com/goravel/framework/http" "github.com/pkg/errors" + "goravel/app/facades" "goravel/app/models" ) diff --git a/app/grpc/interceptors/helper.go b/app/grpc/interceptors/helper.go index 4b037e0..5e1f261 100644 --- a/app/grpc/interceptors/helper.go +++ b/app/grpc/interceptors/helper.go @@ -4,12 +4,12 @@ import ( "io" "strings" - "goravel/app/facades" - "github.com/opentracing/opentracing-go" "github.com/uber/jaeger-client-go" "github.com/uber/jaeger-client-go/transport" "google.golang.org/grpc/metadata" + + "goravel/app/facades" ) type MDReaderWriter struct { diff --git a/app/http/controllers/auth_controller.go b/app/http/controllers/auth_controller.go index 96f6c59..a78d368 100644 --- a/app/http/controllers/auth_controller.go +++ b/app/http/controllers/auth_controller.go @@ -1,11 +1,10 @@ package controllers import ( - "goravel/app/facades" - "github.com/goravel/framework/contracts/http" "github.com/spf13/cast" + "goravel/app/facades" "goravel/app/models" ) diff --git a/app/http/controllers/db_controller.go b/app/http/controllers/db_controller.go index b3fb460..4593307 100644 --- a/app/http/controllers/db_controller.go +++ b/app/http/controllers/db_controller.go @@ -1,10 +1,9 @@ package controllers import ( - "goravel/app/facades" - "github.com/goravel/framework/contracts/http" + "goravel/app/facades" "goravel/app/models" ) diff --git a/app/http/controllers/lang_controller.go b/app/http/controllers/lang_controller.go index 719c366..29fc852 100644 --- a/app/http/controllers/lang_controller.go +++ b/app/http/controllers/lang_controller.go @@ -1,9 +1,9 @@ package controllers import ( - "goravel/app/facades" - "github.com/goravel/framework/contracts/http" + + "goravel/app/facades" ) type LangController struct { diff --git a/app/http/controllers/user_controller.go b/app/http/controllers/user_controller.go index e70e723..5bd27ec 100644 --- a/app/http/controllers/user_controller.go +++ b/app/http/controllers/user_controller.go @@ -1,10 +1,9 @@ package controllers import ( - "goravel/app/facades" - "github.com/goravel/framework/contracts/http" + "goravel/app/facades" "goravel/app/http/requests" "goravel/app/models" ) diff --git a/app/http/controllers/validation_controller.go b/app/http/controllers/validation_controller.go index 5e69822..862ea93 100644 --- a/app/http/controllers/validation_controller.go +++ b/app/http/controllers/validation_controller.go @@ -1,11 +1,10 @@ package controllers import ( - "goravel/app/facades" - "github.com/goravel/framework/contracts/http" "github.com/goravel/framework/support/carbon" + "goravel/app/facades" "goravel/app/http/requests" "goravel/app/models" ) diff --git a/app/http/middleware/jwt.go b/app/http/middleware/jwt.go index cd10124..ec7f6fb 100644 --- a/app/http/middleware/jwt.go +++ b/app/http/middleware/jwt.go @@ -3,10 +3,10 @@ package middleware import ( "errors" - "goravel/app/facades" - "github.com/goravel/framework/auth" "github.com/goravel/framework/contracts/http" + + "goravel/app/facades" ) func Jwt() http.Middleware { diff --git a/app/http/middleware/lang.go b/app/http/middleware/lang.go index 98b6d3b..b24a047 100644 --- a/app/http/middleware/lang.go +++ b/app/http/middleware/lang.go @@ -1,9 +1,9 @@ package middleware import ( - "goravel/app/facades" - httpcontract "github.com/goravel/framework/contracts/http" + + "goravel/app/facades" ) func Lang() httpcontract.Middleware { diff --git a/app/http/middleware/session.go b/app/http/middleware/session.go index dd00db5..90cf9c0 100644 --- a/app/http/middleware/session.go +++ b/app/http/middleware/session.go @@ -1,11 +1,10 @@ package middleware import ( - "goravel/app/models" + "github.com/goravel/framework/contracts/http" "goravel/app/facades" - - "github.com/goravel/framework/contracts/http" + "goravel/app/models" ) func Session() http.Middleware { diff --git a/app/providers/auth_service_provider.go b/app/providers/auth_service_provider.go deleted file mode 100644 index 5caa601..0000000 --- a/app/providers/auth_service_provider.go +++ /dev/null @@ -1,20 +0,0 @@ -package providers - -import ( - "goravel/app/facades" - - frameworkauth "github.com/goravel/framework/auth" - "github.com/goravel/framework/contracts/foundation" -) - -type AuthServiceProvider struct { -} - -func (receiver *AuthServiceProvider) Register(app foundation.Application) { - -} - -func (receiver *AuthServiceProvider) Boot(app foundation.Application) { - facades.Auth().Extend("another-jwt", frameworkauth.NewJwtGuard) - facades.Auth().Provider("another-orm", frameworkauth.NewOrmUserProvider) -} diff --git a/app/providers/route_service_provider.go b/app/providers/route_service_provider.go deleted file mode 100644 index 4bebfb1..0000000 --- a/app/providers/route_service_provider.go +++ /dev/null @@ -1,31 +0,0 @@ -package providers - -import ( - "goravel/app/facades" - - "github.com/goravel/framework/contracts/foundation" - contractshttp "github.com/goravel/framework/contracts/http" - "github.com/goravel/framework/http/limit" -) - -type RouteServiceProvider struct { -} - -func (receiver *RouteServiceProvider) Register(app foundation.Application) { -} - -func (receiver *RouteServiceProvider) Boot(app foundation.Application) { - receiver.configureRateLimiting() -} - -func (receiver *RouteServiceProvider) configureRateLimiting() { - facades.RateLimiter().For("global", func(ctx contractshttp.Context) contractshttp.Limit { - return limit.PerMinute(1000) - }) - facades.RateLimiter().ForWithLimits("ip", func(ctx contractshttp.Context) []contractshttp.Limit { - return []contractshttp.Limit{ - limit.PerDay(1000), - limit.PerMinute(2).By(ctx.Request().Ip()), - } - }) -} diff --git a/app/rules/exists.go b/app/rules/exists.go index cfb3d7a..cbbb26d 100644 --- a/app/rules/exists.go +++ b/app/rules/exists.go @@ -1,9 +1,9 @@ package rules import ( - "goravel/app/facades" - "github.com/goravel/framework/contracts/validation" + + "goravel/app/facades" ) /** diff --git a/app/rules/not_exists.go b/app/rules/not_exists.go index a1c9bb7..aa1803f 100644 --- a/app/rules/not_exists.go +++ b/app/rules/not_exists.go @@ -1,9 +1,9 @@ package rules import ( - "goravel/app/facades" - "github.com/goravel/framework/contracts/validation" + + "goravel/app/facades" ) /** diff --git a/app/services/user.go b/app/services/user.go index 731026b..440abd5 100644 --- a/app/services/user.go +++ b/app/services/user.go @@ -2,7 +2,6 @@ package services import ( "goravel/app/facades" - "goravel/app/models" ) diff --git a/bootstrap/app.go b/bootstrap/app.go index 6156351..e32aecf 100644 --- a/bootstrap/app.go +++ b/bootstrap/app.go @@ -1,6 +1,7 @@ package bootstrap import ( + "github.com/goravel/framework/auth" "github.com/goravel/framework/contracts/database/seeder" "github.com/goravel/framework/contracts/event" "github.com/goravel/framework/contracts/foundation/configuration" @@ -10,6 +11,7 @@ import ( "github.com/goravel/framework/contracts/schedule" "github.com/goravel/framework/contracts/validation" "github.com/goravel/framework/foundation" + "github.com/goravel/framework/http/limit" httpmiddleware "github.com/goravel/framework/http/middleware" "github.com/goravel/framework/session/middleware" "google.golang.org/grpc" @@ -75,8 +77,25 @@ func Boot() { paths.App("app") }). WithProviders(Providers()). - WithSchedule([]schedule.Event{ - facades.Schedule().Call(func() {}), + WithSchedule(func() []schedule.Event { + return []schedule.Event{ + facades.Schedule().Call(func() { + facades.Log().Info("Scheduled Task Executed") + }), + } + }). + WithCallback(func() { + facades.RateLimiter().For("global", func(ctx contractshttp.Context) contractshttp.Limit { + return limit.PerMinute(1000) + }) + facades.RateLimiter().ForWithLimits("ip", func(ctx contractshttp.Context) []contractshttp.Limit { + return []contractshttp.Limit{ + limit.PerDay(1000), + limit.PerMinute(2).By(ctx.Request().Ip()), + } + }) + facades.Auth().Extend("another-jwt", auth.NewJwtGuard) + facades.Auth().Provider("another-orm", auth.NewOrmUserProvider) }). WithConfig(config.Boot). Run() diff --git a/bootstrap/providers.go b/bootstrap/providers.go index c5b7480..a7297dc 100644 --- a/bootstrap/providers.go +++ b/bootstrap/providers.go @@ -1,8 +1,6 @@ package bootstrap import ( - "goravel/app/providers" - "github.com/goravel/cos" "github.com/goravel/fiber" "github.com/goravel/framework/auth" @@ -63,8 +61,6 @@ func Providers() []foundation.ServiceProvider { &filesystem.ServiceProvider{}, &telemetry.ServiceProvider{}, &testing.ServiceProvider{}, - &providers.AuthServiceProvider{}, - &providers.RouteServiceProvider{}, &postgres.ServiceProvider{}, &mysql.ServiceProvider{}, &sqlserver.ServiceProvider{}, diff --git a/database/migrations/20210101000001_create_users_table.go b/database/migrations/20210101000001_create_users_table.go index 90ddaee..9b28ea2 100644 --- a/database/migrations/20210101000001_create_users_table.go +++ b/database/migrations/20210101000001_create_users_table.go @@ -1,9 +1,9 @@ package migrations import ( - "goravel/app/facades" - "github.com/goravel/framework/contracts/database/schema" + + "goravel/app/facades" ) type M20210101000001CreateUsersTable struct { diff --git a/database/migrations/20210101000002_create_jobs_table.go b/database/migrations/20210101000002_create_jobs_table.go index a3901c2..640e004 100644 --- a/database/migrations/20210101000002_create_jobs_table.go +++ b/database/migrations/20210101000002_create_jobs_table.go @@ -1,9 +1,9 @@ package migrations import ( - "goravel/app/facades" - "github.com/goravel/framework/contracts/database/schema" + + "goravel/app/facades" ) type M20210101000002CreateJobsTable struct{} diff --git a/database/migrations/20250330911908_add_columns_to_users_table.go b/database/migrations/20250330911908_add_columns_to_users_table.go index 8542602..22c0881 100755 --- a/database/migrations/20250330911908_add_columns_to_users_table.go +++ b/database/migrations/20250330911908_add_columns_to_users_table.go @@ -1,9 +1,9 @@ package migrations import ( - "goravel/app/facades" - "github.com/goravel/framework/contracts/database/schema" + + "goravel/app/facades" ) type M20250330911908AddColumnsToUsersTable struct{} diff --git a/database/migrations/20250331093125_alert_columns_of_users_table.go b/database/migrations/20250331093125_alert_columns_of_users_table.go index f312c10..8b7ee54 100755 --- a/database/migrations/20250331093125_alert_columns_of_users_table.go +++ b/database/migrations/20250331093125_alert_columns_of_users_table.go @@ -1,9 +1,9 @@ package migrations import ( - "goravel/app/facades" - "github.com/goravel/framework/contracts/database/schema" + + "goravel/app/facades" ) type M20250331093125AlertColumnsOfUsersTable struct{} diff --git a/go.mod b/go.mod index d4b0700..af66b2c 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/goravel/cos v1.4.0 github.com/goravel/example-proto v0.0.1 github.com/goravel/fiber v1.4.1-0.20251109040651-b6c661b58190 - github.com/goravel/framework v1.16.1-0.20251230134041-fade7235c640 + github.com/goravel/framework v1.16.1-0.20251231025904-e7fa6ed025dc github.com/goravel/gin v1.4.1-0.20251109031702-b35766bf8aa3 github.com/goravel/minio v1.4.0 github.com/goravel/mysql v1.4.0 diff --git a/go.sum b/go.sum index 366037d..591c8ed 100644 --- a/go.sum +++ b/go.sum @@ -279,8 +279,8 @@ github.com/goravel/fiber v1.4.1-0.20251109040651-b6c661b58190 h1:Q2rtE7r8M4hkVHZ github.com/goravel/fiber v1.4.1-0.20251109040651-b6c661b58190/go.mod h1:saOGAbRxtjrW+th8K/bYzrKK8WhvD4wxs7ncUstl5Lg= github.com/goravel/file-rotatelogs/v2 v2.4.2 h1:g68AzbePXcm0V2CpUMc9j4qVzcDn7+7aoWSjZ51C0m4= github.com/goravel/file-rotatelogs/v2 v2.4.2/go.mod h1:23VuSW8cBS4ax5cmbV+5AaiLpq25b8UJ96IhbAkdo8I= -github.com/goravel/framework v1.16.1-0.20251230134041-fade7235c640 h1:yDf1PYuskrGVsONDGk+PcOuzvXL7+/p6hu8KGu11FMs= -github.com/goravel/framework v1.16.1-0.20251230134041-fade7235c640/go.mod h1:KIFF13g3DyluGXYAznGRt1DWhvczCAPNv4E62pyE6EA= +github.com/goravel/framework v1.16.1-0.20251231025904-e7fa6ed025dc h1:QzljbFCEa8L9KYjsWdSVfIWmkX1vDGNhRKezAwqjkUE= +github.com/goravel/framework v1.16.1-0.20251231025904-e7fa6ed025dc/go.mod h1:KIFF13g3DyluGXYAznGRt1DWhvczCAPNv4E62pyE6EA= github.com/goravel/gin v1.4.1-0.20251109031702-b35766bf8aa3 h1:K+bN9hZfN0Ia9DkaZCYdwSkqKLmgENXyPEX9RZFKLTw= github.com/goravel/gin v1.4.1-0.20251109031702-b35766bf8aa3/go.mod h1:x1PpRCCTO7IZQ/qvLY0OhSmfcDGZDs7oGqHQngLpwNA= github.com/goravel/minio v1.4.0 h1:WBs6QsN//2Q3sjguzyb1aC/BD6tdFXI3q9GYIjlffzc= diff --git a/main.go b/main.go index cdd38ba..0ca4614 100644 --- a/main.go +++ b/main.go @@ -6,7 +6,6 @@ import ( "syscall" "goravel/app/facades" - "goravel/bootstrap" ) diff --git a/package_test.go b/package_test.go index 967db56..19c2124 100644 --- a/package_test.go +++ b/package_test.go @@ -3,13 +3,12 @@ package main import ( "testing" - "goravel/app/facades" - "github.com/goravel/framework/contracts/foundation" "github.com/goravel/framework/support/file" "github.com/goravel/framework/support/path" "github.com/stretchr/testify/assert" + "goravel/app/facades" "goravel/packages/sms" ) diff --git a/routes/api.go b/routes/api.go index 19a8528..c02396c 100644 --- a/routes/api.go +++ b/routes/api.go @@ -3,12 +3,11 @@ package routes import ( "time" - "goravel/app/facades" - "github.com/goravel/framework/contracts/http" "github.com/goravel/framework/contracts/route" httpmiddleware "github.com/goravel/framework/http/middleware" + "goravel/app/facades" "goravel/app/http/controllers" "goravel/app/http/middleware" ) diff --git a/routes/graphql.go b/routes/graphql.go index bfd4999..d0b546b 100644 --- a/routes/graphql.go +++ b/routes/graphql.go @@ -1,14 +1,13 @@ package routes import ( - "goravel/graph" - "goravel/graph/generated" - - "goravel/app/facades" - "github.com/99designs/gqlgen/graphql/handler" "github.com/99designs/gqlgen/graphql/playground" "github.com/goravel/framework/contracts/http" + + "goravel/app/facades" + "goravel/graph" + "goravel/graph/generated" ) func Graphql() { diff --git a/routes/grpc.go b/routes/grpc.go index 4f07f3e..64ccb00 100644 --- a/routes/grpc.go +++ b/routes/grpc.go @@ -1,10 +1,9 @@ package routes import ( - "goravel/app/facades" - proto "github.com/goravel/example-proto" + "goravel/app/facades" "goravel/app/grpc/controllers" ) diff --git a/routes/web.go b/routes/web.go index 5d50ee0..dc0ab0a 100644 --- a/routes/web.go +++ b/routes/web.go @@ -1,13 +1,12 @@ package routes import ( - "goravel/app/facades" - "github.com/goravel/framework/contracts/http" "github.com/goravel/framework/contracts/route" "github.com/goravel/framework/support" "github.com/spf13/cast" + "goravel/app/facades" "goravel/app/http/controllers" ) diff --git a/tests/feature/db_drivers_test.go b/tests/feature/db_drivers_test.go index 3f42802..1cc89ba 100644 --- a/tests/feature/db_drivers_test.go +++ b/tests/feature/db_drivers_test.go @@ -3,10 +3,10 @@ package feature import ( "testing" - "goravel/app/facades" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" + + "goravel/app/facades" ) func TestDBDrivers(t *testing.T) { diff --git a/tests/feature/db_test.go b/tests/feature/db_test.go index 41a0445..34bbc98 100644 --- a/tests/feature/db_test.go +++ b/tests/feature/db_test.go @@ -5,11 +5,10 @@ package feature import ( "testing" - "goravel/app/facades" - "github.com/goravel/framework/support/carbon" "github.com/stretchr/testify/suite" + "goravel/app/facades" "goravel/tests" ) diff --git a/tests/feature/event_test.go b/tests/feature/event_test.go index edec4c0..2075655 100644 --- a/tests/feature/event_test.go +++ b/tests/feature/event_test.go @@ -4,12 +4,11 @@ import ( "testing" "time" - "goravel/app/facades" - "github.com/goravel/framework/contracts/event" "github.com/stretchr/testify/assert" "goravel/app/events" + "goravel/app/facades" "goravel/app/listeners" ) diff --git a/tests/feature/fiber_test.go b/tests/feature/fiber_test.go index ff17e51..cf06412 100644 --- a/tests/feature/fiber_test.go +++ b/tests/feature/fiber_test.go @@ -3,9 +3,9 @@ package feature import ( "testing" - "goravel/app/facades" - "github.com/stretchr/testify/suite" + + "goravel/app/facades" ) func TestFiberDriver(t *testing.T) { diff --git a/tests/feature/filesystem_test.go b/tests/feature/filesystem_test.go index 4650526..b4d42d6 100644 --- a/tests/feature/filesystem_test.go +++ b/tests/feature/filesystem_test.go @@ -3,12 +3,9 @@ package feature import ( "context" "fmt" - "goravel/tests" "os" "testing" - "goravel/app/facades" - "github.com/goravel/framework/contracts/filesystem" contractsdocker "github.com/goravel/framework/contracts/testing/docker" supportdocker "github.com/goravel/framework/support/docker" @@ -16,6 +13,9 @@ import ( "github.com/minio/minio-go/v7" "github.com/minio/minio-go/v7/pkg/credentials" "github.com/stretchr/testify/suite" + + "goravel/app/facades" + "goravel/tests" ) type FilesystemTestSuite struct { diff --git a/tests/feature/http_client_test.go b/tests/feature/http_client_test.go index c1f851e..330e1cf 100644 --- a/tests/feature/http_client_test.go +++ b/tests/feature/http_client_test.go @@ -3,10 +3,9 @@ package feature import ( "testing" - "goravel/app/facades" - "github.com/stretchr/testify/suite" + "goravel/app/facades" "goravel/tests" ) diff --git a/tests/feature/main_test.go b/tests/feature/main_test.go index 9453b0f..53fe3da 100644 --- a/tests/feature/main_test.go +++ b/tests/feature/main_test.go @@ -5,9 +5,9 @@ import ( "testing" "time" - "goravel/app/facades" - "github.com/goravel/framework/support/file" + + "goravel/app/facades" ) func TestMain(m *testing.M) { diff --git a/tests/feature/migration_test.go b/tests/feature/migration_test.go index 4f93e36..a31cf4f 100644 --- a/tests/feature/migration_test.go +++ b/tests/feature/migration_test.go @@ -3,13 +3,12 @@ package feature import ( "testing" - "goravel/app/facades" - "github.com/goravel/mysql" "github.com/goravel/sqlite" "github.com/goravel/sqlserver" "github.com/stretchr/testify/suite" + "goravel/app/facades" "goravel/tests" ) diff --git a/tests/feature/orm_test.go b/tests/feature/orm_test.go index 38986d6..c41b86f 100644 --- a/tests/feature/orm_test.go +++ b/tests/feature/orm_test.go @@ -3,10 +3,9 @@ package feature import ( "testing" - "goravel/app/facades" - "github.com/stretchr/testify/suite" + "goravel/app/facades" "goravel/app/models" "goravel/tests" ) diff --git a/tests/feature/queue_test.go b/tests/feature/queue_test.go index cc7175b..ae44725 100644 --- a/tests/feature/queue_test.go +++ b/tests/feature/queue_test.go @@ -5,13 +5,12 @@ import ( "testing" "time" - "goravel/app/facades" - contractsqueue "github.com/goravel/framework/contracts/queue" "github.com/goravel/framework/queue/utils" "github.com/goravel/framework/support/carbon" "github.com/stretchr/testify/suite" + "goravel/app/facades" "goravel/app/jobs" "goravel/tests" ) diff --git a/tests/feature/redis_test.go b/tests/feature/redis_test.go index 07390e6..44901d6 100644 --- a/tests/feature/redis_test.go +++ b/tests/feature/redis_test.go @@ -3,10 +3,10 @@ package feature import ( "testing" - "goravel/app/facades" - "github.com/goravel/framework/contracts/queue" "github.com/stretchr/testify/suite" + + "goravel/app/facades" ) func TestRedisDriver(t *testing.T) { diff --git a/tests/services/main_test.go b/tests/services/main_test.go index 90f22fe..7980161 100644 --- a/tests/services/main_test.go +++ b/tests/services/main_test.go @@ -3,9 +3,9 @@ package services import ( "testing" - "goravel/app/facades" - "github.com/goravel/framework/support/file" + + "goravel/app/facades" ) func TestMain(m *testing.M) { From 4d96d767c65b230c9886f35c19312606164ab9a4 Mon Sep 17 00:00:00 2001 From: Bowen Date: Wed, 31 Dec 2025 17:54:22 +0800 Subject: [PATCH 3/4] optimize --- app/filters/test.go | 39 +++++----- app/http/controllers/validation_controller.go | 71 ++++++++++++++----- .../controllers/validation_controller_test.go | 15 ++-- app/http/requests/validation_create.go | 22 ++++-- app/rules/exists.go | 6 +- app/rules/not_exists.go | 6 +- bootstrap/app.go | 8 ++- go.mod | 8 ++- go.sum | 10 +-- main.go | 53 +------------- tests/feature/http_test.go | 24 ++++++- tests/feature/main_test.go | 9 --- 12 files changed, 143 insertions(+), 128 deletions(-) diff --git a/app/filters/test.go b/app/filters/test.go index d441b67..062007f 100755 --- a/app/filters/test.go +++ b/app/filters/test.go @@ -1,5 +1,7 @@ package filters +import "context" + type Test struct { } @@ -19,26 +21,25 @@ func (receiver *Test) Signature() string { // // Example usages: // -// 1. Return only the transformed value: -// func (val string) int { -// // conversion logic -// return 1 -// } -// -// 2. Return the transformed value and an error: -// func (val int) (int, error) { -// // conversion logic with error handling -// return 1, nil -// } +// 1. Return only the transformed value: +// func (val string) int { +// // conversion logic +// return 1 +// } // -// 3. Take additional arguments: -// func (val string, def ...string) string { -// if val == "" && len(def) > 0 { -// return def[0] -// } -// return val -// } +// 2. Return the transformed value and an error: +// func (val int) (int, error) { +// // conversion logic with error handling +// return 1, nil +// } // -func (receiver *Test) Handle() any { +// 3. Take additional arguments: +// func (val string, def ...string) string { +// if val == "" && len(def) > 0 { +// return def[0] +// } +// return val +// } +func (receiver *Test) Handle(ctx context.Context) any { return nil } diff --git a/app/http/controllers/validation_controller.go b/app/http/controllers/validation_controller.go index 862ea93..220187d 100644 --- a/app/http/controllers/validation_controller.go +++ b/app/http/controllers/validation_controller.go @@ -1,12 +1,15 @@ package controllers import ( + "context" + "github.com/goravel/framework/contracts/http" + contractsvalidation "github.com/goravel/framework/contracts/validation" "github.com/goravel/framework/support/carbon" + "github.com/goravel/framework/validation" "goravel/app/facades" "goravel/app/http/requests" - "goravel/app/models" ) /********************************* @@ -31,8 +34,9 @@ air ********************************/ type User struct { - Name string `json:"name" form:"name"` - Date *carbon.DateTime `json:"date" form:"date"` + Context string `json:"context" form:"context"` + Name string `json:"name" form:"name"` + Date *carbon.DateTime `json:"date" form:"date"` } type ValidationController struct { @@ -46,10 +50,21 @@ func NewValidationController() *ValidationController { } func (r *ValidationController) Json(ctx http.Context) http.Response { + ctx.WithValue("ctx", "context") validator, err := ctx.Request().Validate(map[string]string{ - "name": "required", - "date": "required|date", - }) + "context": "required", + "name": "required", + "date": "required|date", + }, validation.PrepareForValidation(func(ctx context.Context, data contractsvalidation.Data) error { + if c, exist := data.Get("context"); exist { + // Test getting value from context: ValidationController.Request + if err := data.Set("context", c.(string)+"_"+ctx.Value("ctx").(string)); err != nil { + return err + } + } + + return nil + })) if err != nil { return ctx.Response().Json(http.StatusBadRequest, http.Json{ "message": err.Error(), @@ -69,12 +84,16 @@ func (r *ValidationController) Json(ctx http.Context) http.Response { } return ctx.Response().Success().Json(http.Json{ - "name": user.Name, - "date": user.Date.ToDateTimeString(), + "context": user.Context, + "name": user.Name, + "date": user.Date.ToDateTimeString(), }) } func (r *ValidationController) Request(ctx http.Context) http.Response { + // Set context value for testing PrepareForValidation + ctx.WithValue("ctx", "context") + var validationCreate requests.ValidationCreate errors, err := ctx.Request().ValidateRequest(&validationCreate) if err != nil { @@ -89,20 +108,33 @@ func (r *ValidationController) Request(ctx http.Context) http.Response { } return ctx.Response().Success().Json(http.Json{ - "name": validationCreate.Name, - "tags": validationCreate.Tags, - "scores": validationCreate.Scores, - "date": validationCreate.Date.ToDateTimeString(), - "code": validationCreate.Code, + "context": validationCreate.Context, + "name": validationCreate.Name, + "tags": validationCreate.Tags, + "scores": validationCreate.Scores, + "date": validationCreate.Date.ToDateTimeString(), + "code": validationCreate.Code, }) } func (r *ValidationController) Form(ctx http.Context) http.Response { - validator, err := facades.Validation().Make(map[string]any{ - "name": ctx.Request().Input("name"), + ctx.WithValue("ctx", "context") + validator, err := facades.Validation().Make(ctx, map[string]any{ + "context": ctx.Request().Input("context"), + "name": ctx.Request().Input("name"), }, map[string]string{ - "name": "required", - }) + "context": "required", + "name": "required", + }, validation.PrepareForValidation(func(ctx context.Context, data contractsvalidation.Data) error { + if c, exist := data.Get("context"); exist { + // Test getting value from context: ValidationController.Request + if err := data.Set("context", c.(string)+"_"+ctx.Value("ctx").(string)); err != nil { + return err + } + } + + return nil + })) if err != nil { return ctx.Response().Json(http.StatusBadRequest, http.Json{ "message": err.Error(), @@ -114,7 +146,7 @@ func (r *ValidationController) Form(ctx http.Context) http.Response { }) } - var user models.User + var user User if err := validator.Bind(&user); err != nil { return ctx.Response().Json(http.StatusBadRequest, http.Json{ "message": err.Error(), @@ -122,6 +154,7 @@ func (r *ValidationController) Form(ctx http.Context) http.Response { } return ctx.Response().Success().Json(http.Json{ - "name": user.Name, + "context": user.Context, + "name": user.Name, }) } diff --git a/app/http/controllers/validation_controller_test.go b/app/http/controllers/validation_controller_test.go index 1e93614..8b97d8e 100644 --- a/app/http/controllers/validation_controller_test.go +++ b/app/http/controllers/validation_controller_test.go @@ -7,6 +7,7 @@ import ( "github.com/goravel/framework/support/carbon" testingmock "github.com/goravel/framework/testing/mock" "github.com/goravel/gin" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" ) @@ -32,14 +33,17 @@ func (s *ValidationControllerTestSuite) TestJson() { mockRequest := mockFactory.ContextRequest() mockResponse := mockFactory.ContextResponse() mockValidator := mockFactory.ValidationValidator() + mockContext.EXPECT().WithValue("ctx", "context").Once() mockContext.EXPECT().Request().Return(mockRequest).Once() mockRequest.EXPECT().Validate(map[string]string{ - "name": "required", - "date": "required|date", - }).Return(mockValidator, nil).Once() + "context": "required", + "name": "required", + "date": "required|date", + }, mock.AnythingOfType("validation.Option")).Return(mockValidator, nil).Once() mockValidator.EXPECT().Fails().Return(false).Once() var user User mockValidator.EXPECT().Bind(&user).Run(func(user any) { + user.(*User).Context = "ctx_context" user.(*User).Name = "Goravel" user.(*User).Date = carbon.NewDateTime(carbon.Parse("2024-07-08 22:34:31")) }).Return(nil).Once() @@ -49,8 +53,9 @@ func (s *ValidationControllerTestSuite) TestJson() { resp := &gin.JsonResponse{} mockResponseStatus.EXPECT().Json(http.Json{ - "name": "Goravel", - "date": "2024-07-08 22:34:31", + "context": "ctx_context", + "name": "Goravel", + "date": "2024-07-08 22:34:31", }).Return(resp).Once() s.Equal(resp, NewValidationController().Json(mockContext)) diff --git a/app/http/requests/validation_create.go b/app/http/requests/validation_create.go index 637656c..7f146f1 100644 --- a/app/http/requests/validation_create.go +++ b/app/http/requests/validation_create.go @@ -8,11 +8,12 @@ import ( ) type ValidationCreate struct { - Name string `form:"name" json:"name"` - Tags []string `form:"tags" json:"tags"` - Scores []int `form:"scores" json:"scores"` - Date carbon.Carbon `form:"date" json:"date"` - Code int `form:"code" json:"code"` + Context string `form:"context" json:"context"` + Name string `form:"name" json:"name"` + Tags []string `form:"tags" json:"tags"` + Scores []int `form:"scores" json:"scores"` + Date carbon.Carbon `form:"date" json:"date"` + Code int `form:"code" json:"code"` } func (r *ValidationCreate) Authorize(ctx http.Context) error { @@ -22,6 +23,7 @@ func (r *ValidationCreate) Authorize(ctx http.Context) error { func (r *ValidationCreate) Rules(ctx http.Context) map[string]string { return map[string]string{ "name": "required", + "context": "required", "tags.*": "required|string", "scores.*": "required|int", "date": "required|date", @@ -39,7 +41,15 @@ func (r *ValidationCreate) Attributes(ctx http.Context) map[string]string { func (r *ValidationCreate) PrepareForValidation(ctx http.Context, data validation.Data) error { if scores, exist := data.Get("scores"); exist { - return data.Set("scores", cast.ToIntSlice(scores)) + if err := data.Set("scores", cast.ToIntSlice(scores)); err != nil { + return err + } + } + if c, exist := data.Get("context"); exist { + // Test getting value from context: ValidationController.Request + if err := data.Set("context", c.(string)+"_"+ctx.Value("ctx").(string)); err != nil { + return err + } } return nil diff --git a/app/rules/exists.go b/app/rules/exists.go index cbbb26d..2effb4a 100644 --- a/app/rules/exists.go +++ b/app/rules/exists.go @@ -1,6 +1,8 @@ package rules import ( + "context" + "github.com/goravel/framework/contracts/validation" "goravel/app/facades" @@ -24,7 +26,7 @@ func (receiver *Exists) Signature() string { } // Passes Determine if the validation rule passes. -func (receiver *Exists) Passes(_ validation.Data, val any, options ...any) bool { +func (receiver *Exists) Passes(ctx context.Context, _ validation.Data, val any, options ...any) bool { tableName := options[0].(string) fieldName := options[1].(string) @@ -50,6 +52,6 @@ func (receiver *Exists) Passes(_ validation.Data, val any, options ...any) bool } // Message Get the validation error message. -func (receiver *Exists) Message() string { +func (receiver *Exists) Message(ctx context.Context) string { return "record does not exist" } diff --git a/app/rules/not_exists.go b/app/rules/not_exists.go index aa1803f..59d0d36 100644 --- a/app/rules/not_exists.go +++ b/app/rules/not_exists.go @@ -1,6 +1,8 @@ package rules import ( + "context" + "github.com/goravel/framework/contracts/validation" "goravel/app/facades" @@ -24,7 +26,7 @@ func (receiver *NotExists) Signature() string { } // Passes Determine if the validation rule passes. -func (receiver *NotExists) Passes(_ validation.Data, val any, options ...any) bool { +func (receiver *NotExists) Passes(ctx context.Context, _ validation.Data, val any, options ...any) bool { tableName := options[0].(string) fieldName := options[1].(string) @@ -50,6 +52,6 @@ func (receiver *NotExists) Passes(_ validation.Data, val any, options ...any) bo } // Message Get the validation error message. -func (receiver *NotExists) Message() string { +func (receiver *NotExists) Message(ctx context.Context) string { return "record already exists" } diff --git a/bootstrap/app.go b/bootstrap/app.go index e32aecf..4cbdcca 100644 --- a/bootstrap/app.go +++ b/bootstrap/app.go @@ -4,6 +4,7 @@ import ( "github.com/goravel/framework/auth" "github.com/goravel/framework/contracts/database/seeder" "github.com/goravel/framework/contracts/event" + contractsfoundation "github.com/goravel/framework/contracts/foundation" "github.com/goravel/framework/contracts/foundation/configuration" "github.com/goravel/framework/contracts/http" contractshttp "github.com/goravel/framework/contracts/http" @@ -28,8 +29,8 @@ import ( "goravel/routes" ) -func Boot() { - foundation.Setup(). +func Boot() contractsfoundation.Application { + return foundation.Setup(). WithFilters(Filters()). WithCommands(Commands()). WithMigrations(Migrations()). @@ -38,6 +39,7 @@ func Boot() { }). WithRouting([]func(){ routes.Web, + routes.Api, routes.Grpc, routes.Graphql, }). @@ -98,5 +100,5 @@ func Boot() { facades.Auth().Provider("another-orm", auth.NewOrmUserProvider) }). WithConfig(config.Boot). - Run() + Start() } diff --git a/go.mod b/go.mod index af66b2c..668bcb2 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.24.0 require ( github.com/99designs/gqlgen v0.17.57 github.com/gin-gonic/gin v1.11.0 - github.com/gofiber/fiber/v2 v2.52.9 + github.com/gofiber/fiber/v2 v2.52.10 github.com/gofiber/template/html/v2 v2.1.3 github.com/goravel/cos v1.4.0 github.com/goravel/example-proto v0.0.1 @@ -234,3 +234,9 @@ require ( gorm.io/gorm v1.31.1 // indirect gorm.io/plugin/dbresolver v1.6.2 // indirect ) + +replace github.com/goravel/framework => ../goravel/framework + +replace github.com/goravel/gin => ../goravel/gin + +replace github.com/goravel/fiber => ../goravel/fiber diff --git a/go.sum b/go.sum index 591c8ed..1872bbc 100644 --- a/go.sum +++ b/go.sum @@ -223,8 +223,8 @@ github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw= github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= -github.com/gofiber/fiber/v2 v2.52.9 h1:YjKl5DOiyP3j0mO61u3NTmK7or8GzzWzCFzkboyP5cw= -github.com/gofiber/fiber/v2 v2.52.9/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw= +github.com/gofiber/fiber/v2 v2.52.10 h1:jRHROi2BuNti6NYXmZ6gbNSfT3zj/8c0xy94GOU5elY= +github.com/gofiber/fiber/v2 v2.52.10/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw= github.com/gofiber/template v1.8.3 h1:hzHdvMwMo/T2kouz2pPCA0zGiLCeMnoGsQZBTSYgZxc= github.com/gofiber/template v1.8.3/go.mod h1:bs/2n0pSNPOkRa5VJ8zTIvedcI/lEYxzV3+YPXdBvq8= github.com/gofiber/template/html/v2 v2.1.3 h1:n1LYBtmr9C0V/k/3qBblXyMxV5B0o/gpb6dFLp8ea+o= @@ -275,14 +275,8 @@ github.com/goravel/cos v1.4.0 h1:YDn7Zhkf0Qi0OLVB2rCsf0EH1h6KJM+sTAMyL2ELuE0= github.com/goravel/cos v1.4.0/go.mod h1:zAYN6E2kLvDIgfmEDZnSaGlgTI6cWKTC+trDcgiU1Wo= github.com/goravel/example-proto v0.0.1 h1:ZxETeKREQWjuJ49bX/Hqj1NLR5Vyj489Ks6dRxYeQsk= github.com/goravel/example-proto v0.0.1/go.mod h1:I8IPsHr4Ndf7KxmdsRpBR2LQ0Geo48+pjv9IIWf3mZg= -github.com/goravel/fiber v1.4.1-0.20251109040651-b6c661b58190 h1:Q2rtE7r8M4hkVHZhVAFV9sAWK/bXJ/X1nBdeWgfqLfA= -github.com/goravel/fiber v1.4.1-0.20251109040651-b6c661b58190/go.mod h1:saOGAbRxtjrW+th8K/bYzrKK8WhvD4wxs7ncUstl5Lg= github.com/goravel/file-rotatelogs/v2 v2.4.2 h1:g68AzbePXcm0V2CpUMc9j4qVzcDn7+7aoWSjZ51C0m4= github.com/goravel/file-rotatelogs/v2 v2.4.2/go.mod h1:23VuSW8cBS4ax5cmbV+5AaiLpq25b8UJ96IhbAkdo8I= -github.com/goravel/framework v1.16.1-0.20251231025904-e7fa6ed025dc h1:QzljbFCEa8L9KYjsWdSVfIWmkX1vDGNhRKezAwqjkUE= -github.com/goravel/framework v1.16.1-0.20251231025904-e7fa6ed025dc/go.mod h1:KIFF13g3DyluGXYAznGRt1DWhvczCAPNv4E62pyE6EA= -github.com/goravel/gin v1.4.1-0.20251109031702-b35766bf8aa3 h1:K+bN9hZfN0Ia9DkaZCYdwSkqKLmgENXyPEX9RZFKLTw= -github.com/goravel/gin v1.4.1-0.20251109031702-b35766bf8aa3/go.mod h1:x1PpRCCTO7IZQ/qvLY0OhSmfcDGZDs7oGqHQngLpwNA= github.com/goravel/minio v1.4.0 h1:WBs6QsN//2Q3sjguzyb1aC/BD6tdFXI3q9GYIjlffzc= github.com/goravel/minio v1.4.0/go.mod h1:a/lwfo3eq6cPpyBXjjOsPhboj1LGlqbZo6gHSEX14PA= github.com/goravel/mysql v1.4.0 h1:UjarXJ4UIPeOSU/xKo0eFRYpSV30TS8H4aXcBvjOcow= diff --git a/main.go b/main.go index 0ca4614..003976e 100644 --- a/main.go +++ b/main.go @@ -1,59 +1,10 @@ package main import ( - "os" - "os/signal" - "syscall" - - "goravel/app/facades" "goravel/bootstrap" ) func main() { - // This bootstraps the framework and gets it ready for use. - bootstrap.Boot() - - // Create a channel to listen for OS signals - quit := make(chan os.Signal, 1) - signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM) - - // Start http server by facades.Route(). - go func() { - if err := facades.Route().Run(); err != nil { - facades.Log().Errorf("Route run error: %v", err) - } - }() - - // Start grpc server by facades.Grpc(). - go func() { - if err := facades.Grpc().Run(); err != nil { - facades.Log().Errorf("Grpc run error: %v", err) - } - }() - - // Start queue server by facades.Queue(). - worker := facades.Queue().Worker() - go func() { - if err := worker.Run(); err != nil { - facades.Log().Errorf("Queue run error: %v", err) - } - }() - - // Listen for the OS signal - go func() { - <-quit - if err := facades.Route().Shutdown(); err != nil { - facades.Log().Errorf("Route Shutdown error: %v", err) - } - if err := facades.Grpc().Shutdown(); err != nil { - facades.Log().Errorf("Grpc Shutdown error: %v", err) - } - if err := worker.Shutdown(); err != nil { - facades.Log().Errorf("Queue Shutdown error: %v", err) - } - - os.Exit(0) - }() - - select {} + app := bootstrap.Boot() + app.Wait() } diff --git a/tests/feature/http_test.go b/tests/feature/http_test.go index e0e6317..ffa1092 100644 --- a/tests/feature/http_test.go +++ b/tests/feature/http_test.go @@ -160,7 +160,7 @@ func (s *HttpTestSuite) TestFallback() { func (s *HttpTestSuite) TestFiles() { body, err := http.NewBody().SetFiles(map[string][]string{ - "files": []string{"lang/cn.json", "lang/en.json"}, + "files": {"lang/cn.json", "lang/en.json"}, }).Build() s.Require().NoError(err) @@ -368,8 +368,24 @@ func (s *HttpTestSuite) TestUsers() { s.Equal("{\"users\":[]}", context) } +func (s *HttpTestSuite) TestValidationForm() { + payload := strings.NewReader(`{ + "context": "ctx", + "name": "Goravel" + }`) + + resp, err := s.Http(s.T()).Post("/validation/form", payload) + + s.NoError(err) + resp.AssertSuccessful() + context, err := resp.Content() + s.Require().NoError(err) + s.Equal("{\"context\":\"ctx_context\",\"name\":\"Goravel\"}", context) +} + func (s *HttpTestSuite) TestValidationJson() { payload := strings.NewReader(`{ + "context": "ctx", "name": "Goravel", "date": "2024-07-08 18:33:32" }`) @@ -380,13 +396,14 @@ func (s *HttpTestSuite) TestValidationJson() { resp.AssertSuccessful() context, err := resp.Content() s.Require().NoError(err) - s.Equal("{\"date\":\"2024-07-08 18:33:32\",\"name\":\"Goravel\"}", context) + s.Equal("{\"context\":\"ctx_context\",\"date\":\"2024-07-08 18:33:32\",\"name\":\"Goravel\"}", context) } func (s *HttpTestSuite) TestValidationRequest() { s.Run("success", func() { payload := strings.NewReader(`{ "name": " Goravel ", + "context": "ctx", "date": "2024-07-08 18:33:32", "tags": ["tag1", "tag2"], "scores": [1, 2], @@ -399,11 +416,12 @@ func (s *HttpTestSuite) TestValidationRequest() { resp.AssertSuccessful() context, err := resp.Content() s.Require().NoError(err) - s.Equal("{\"code\":123456,\"date\":\"2024-07-08 18:33:32\",\"name\":\"Goravel\",\"scores\":[1,2],\"tags\":[\"tag1\",\"tag2\"]}", context) + s.Equal("{\"code\":123456,\"context\":\"ctx_context\",\"date\":\"2024-07-08 18:33:32\",\"name\":\"Goravel\",\"scores\":[1,2],\"tags\":[\"tag1\",\"tag2\"]}", context) }) s.Run("failed", func() { payload := strings.NewReader(`{ + "context": "ctx", "date": "1", "tags": "tag1", "scores": 1, diff --git a/tests/feature/main_test.go b/tests/feature/main_test.go index 53fe3da..90f4f13 100644 --- a/tests/feature/main_test.go +++ b/tests/feature/main_test.go @@ -3,7 +3,6 @@ package feature import ( "os" "testing" - "time" "github.com/goravel/framework/support/file" @@ -34,14 +33,6 @@ func TestMain(m *testing.M) { } facades.Config().Add("database.redis.default.port", cache.Config().Port) - go func() { - if err := facades.Route().Run(); err != nil { - facades.Log().Errorf("Route run error: %v", err) - } - }() - - time.Sleep(1 * time.Second) - exit := m.Run() if err := file.Remove("storage"); err != nil { From 01a2b5f1148241c8dd5a5d92fe64b32a6d1769ee Mon Sep 17 00:00:00 2001 From: Bowen Date: Wed, 31 Dec 2025 18:01:55 +0800 Subject: [PATCH 4/4] optimize --- app/grpc/interceptors/opentracing_client.go | 11 ----------- app/grpc/interceptors/opentracing_server.go | 11 ----------- app/grpc/interceptors/test_client.go | 11 +++++++++++ app/grpc/interceptors/test_server.go | 11 +++++++++++ bootstrap/app.go | 4 ++-- bootstrap/providers.go | 2 -- 6 files changed, 24 insertions(+), 26 deletions(-) delete mode 100644 app/grpc/interceptors/opentracing_client.go delete mode 100644 app/grpc/interceptors/opentracing_server.go create mode 100644 app/grpc/interceptors/test_client.go create mode 100644 app/grpc/interceptors/test_server.go diff --git a/app/grpc/interceptors/opentracing_client.go b/app/grpc/interceptors/opentracing_client.go deleted file mode 100644 index a359dc3..0000000 --- a/app/grpc/interceptors/opentracing_client.go +++ /dev/null @@ -1,11 +0,0 @@ -package interceptors - -import ( - "context" - - "google.golang.org/grpc" -) - -func OpentracingClient(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { - return nil -} diff --git a/app/grpc/interceptors/opentracing_server.go b/app/grpc/interceptors/opentracing_server.go deleted file mode 100644 index 97e5455..0000000 --- a/app/grpc/interceptors/opentracing_server.go +++ /dev/null @@ -1,11 +0,0 @@ -package interceptors - -import ( - "context" - - "google.golang.org/grpc" -) - -func OpentracingServer(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error) { - return handler(ctx, req) -} diff --git a/app/grpc/interceptors/test_client.go b/app/grpc/interceptors/test_client.go new file mode 100644 index 0000000..64fbbb1 --- /dev/null +++ b/app/grpc/interceptors/test_client.go @@ -0,0 +1,11 @@ +package interceptors + +import ( + "context" + + "google.golang.org/grpc" +) + +func TestClient(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { + return nil +} diff --git a/app/grpc/interceptors/test_server.go b/app/grpc/interceptors/test_server.go new file mode 100644 index 0000000..e1f6aaa --- /dev/null +++ b/app/grpc/interceptors/test_server.go @@ -0,0 +1,11 @@ +package interceptors + +import ( + "context" + + "google.golang.org/grpc" +) + +func TestServer(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error) { + return handler(ctx, req) +} diff --git a/bootstrap/app.go b/bootstrap/app.go index 4cbdcca..f38b30b 100644 --- a/bootstrap/app.go +++ b/bootstrap/app.go @@ -66,11 +66,11 @@ func Boot() contractsfoundation.Application { }) }). WithGrpcServerInterceptors([]grpc.UnaryServerInterceptor{ - interceptors.OpentracingServer, + interceptors.TestServer, }). WithGrpcClientInterceptors(map[string][]grpc.UnaryClientInterceptor{ "default": { - interceptors.OpentracingClient, + interceptors.TestClient, }, }). WithGrpcServerStatsHandlers([]stats.Handler{}). diff --git a/bootstrap/providers.go b/bootstrap/providers.go index a7297dc..f112db8 100644 --- a/bootstrap/providers.go +++ b/bootstrap/providers.go @@ -45,9 +45,7 @@ func Providers() []foundation.ServiceProvider { &http.ServiceProvider{}, &view.ServiceProvider{}, &route.ServiceProvider{}, - &gin.ServiceProvider{}, &database.ServiceProvider{}, - &postgres.ServiceProvider{}, &auth.ServiceProvider{}, &crypt.ServiceProvider{}, &queue.ServiceProvider{},