Skip to content

Commit c31a35d

Browse files
committed
chore(examples): remove database-demo example and related resources
- Deleted the `database-demo` example module, including `main.go`, `README.md`, and associated resources, to streamline and declutter the codebase. - Removed outdated dependencies in `go.sum` related to the deleted example. Signed-off-by: Rex Raphael <rex.raphael@outlook.com>
1 parent 4bf291c commit c31a35d

132 files changed

Lines changed: 9507 additions & 2307 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,8 @@ The `examples/` directory contains production-ready examples:
401401
- **[Minimal App](examples/minimal-app/)** - Hello World
402402
- **[Configuration](examples/config-example/)** - Config management
403403
- **[Database](examples/database-demo/)** - Database integration
404-
- **[Auth](examples/auth_example/)** - Authentication
405-
- **[GraphQL](examples/graphql-basic/)** - GraphQL server
404+
- **[Auth](extensions/auth/examples/auth_example/)** - Authentication
405+
- **[GraphQL](extensions/graphql/examples/graphql-basic/)** - GraphQL server
406406
- **[gRPC](examples/grpc-basic/)** - gRPC services
407407
- **[WebRTC](examples/webrtc/)** - Real-time communication
408408
- **[MCP](examples/mcp-basic/)** - Model Context Protocol

app_di_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ func TestBothPatternsResolveSameInstance(t *testing.T) {
168168
t.Run("Logger - same instance", func(t *testing.T) {
169169
loggerByType, _ := forge.InjectType[forge.Logger](container)
170170
loggerByKey, _ := forge.GetLogger(container)
171-
171+
172172
if loggerByType != loggerByKey {
173173
t.Error("Logger resolved by type and key are different instances")
174174
}
@@ -177,7 +177,7 @@ func TestBothPatternsResolveSameInstance(t *testing.T) {
177177
t.Run("Metrics - same instance", func(t *testing.T) {
178178
metricsByType, _ := forge.InjectType[forge.Metrics](container)
179179
metricsByKey, _ := forge.GetMetrics(container)
180-
180+
181181
if metricsByType != metricsByKey {
182182
t.Error("Metrics resolved by type and key are different instances")
183183
}
@@ -186,7 +186,7 @@ func TestBothPatternsResolveSameInstance(t *testing.T) {
186186
t.Run("HealthManager - same instance", func(t *testing.T) {
187187
healthByType, _ := forge.InjectType[forge.HealthManager](container)
188188
healthByKey, _ := forge.GetHealthManager(container)
189-
189+
190190
if healthByType != healthByKey {
191191
t.Error("HealthManager resolved by type and key are different instances")
192192
}

cli/forge_integration.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,20 @@ func addForgeCommands(cli CLI, app forge.App) {
8585
}
8686

8787
report := health.Check(ctx.Context())
88-
status := health.GetStatus()
88+
89+
// Determine overall status from report
90+
status := forge.HealthStatusHealthy
91+
if report != nil && len(report.Services) > 0 {
92+
// Check if any service is unhealthy
93+
for _, result := range report.Services {
94+
if result.Status == forge.HealthStatusUnhealthy {
95+
status = forge.HealthStatusUnhealthy
96+
break
97+
} else if result.Status == forge.HealthStatusDegraded && status == forge.HealthStatusHealthy {
98+
status = forge.HealthStatusDegraded
99+
}
100+
}
101+
}
89102

90103
if status == forge.HealthStatusHealthy {
91104
ctx.Success("Application is healthy")

cmd/forge/README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
Enterprise-grade command-line interface for Forge framework.
44

5+
## Module Structure
6+
7+
The Forge CLI (`cmd/forge`) is a **separate Go module** from the main Forge framework. This separation is necessary because the CLI depends on `github.com/xraph/forge/extensions/database`, which creates a circular dependency if included in the main module.
8+
9+
The module structure:
10+
- **Main module**: `github.com/xraph/forge` - Core framework
11+
- **Database extension**: `github.com/xraph/forge/extensions/database` - Separate module
12+
- **Forge CLI**: `github.com/xraph/forge/cmd/forge` - Separate module (depends on database extension)
13+
514
## Installation
615

716
```bash
@@ -11,8 +20,8 @@ go install github.com/xraph/forge/cmd/forge@latest
1120
Or build from source:
1221

1322
```bash
14-
cd v2/cmd/forge
15-
go build -o forge main.go
23+
cd cmd/forge
24+
go build -o forge .
1625
```
1726

1827
## Quick Start
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/xraph/forge/examples/database-demo
1+
module github.com/xraph/forge/cmd/forge
22

33
go 1.25.3
44

@@ -7,9 +7,14 @@ replace github.com/xraph/forge => ../..
77
replace github.com/xraph/forge/extensions/database => ../../extensions/database
88

99
require (
10+
github.com/fsnotify/fsnotify v1.9.0
11+
github.com/joho/godotenv v1.5.1
12+
github.com/stretchr/testify v1.11.1
1013
github.com/uptrace/bun v1.2.15
1114
github.com/xraph/forge v0.0.6
1215
github.com/xraph/forge/extensions/database v0.0.0-00010101000000-000000000000
16+
golang.org/x/text v0.33.0
17+
gopkg.in/yaml.v3 v3.0.1
1318
)
1419

1520
require (
@@ -22,7 +27,6 @@ require (
2227
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
2328
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
2429
github.com/fatih/color v1.18.0 // indirect
25-
github.com/fsnotify/fsnotify v1.9.0 // indirect
2630
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
2731
github.com/gabriel-vasile/mimetype v1.4.12 // indirect
2832
github.com/go-logr/logr v1.4.3 // indirect
@@ -64,6 +68,7 @@ require (
6468
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
6569
github.com/montanaflynn/stats v0.7.1 // indirect
6670
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
71+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
6772
github.com/puzpuzpuz/xsync/v3 v3.5.1 // indirect
6873
github.com/quic-go/qpack v0.5.1 // indirect
6974
github.com/quic-go/quic-go v0.55.0 // indirect
@@ -93,19 +98,17 @@ require (
9398
go.yaml.in/yaml/v3 v3.0.4 // indirect
9499
golang.org/x/crypto v0.46.0 // indirect
95100
golang.org/x/exp v0.0.0-20250808145144-a408d31f581a // indirect
96-
golang.org/x/mod v0.30.0 // indirect
97-
golang.org/x/net v0.47.0 // indirect
101+
golang.org/x/mod v0.31.0 // indirect
102+
golang.org/x/net v0.48.0 // indirect
98103
golang.org/x/oauth2 v0.30.0 // indirect
99104
golang.org/x/sync v0.19.0 // indirect
100105
golang.org/x/sys v0.39.0 // indirect
101106
golang.org/x/term v0.38.0 // indirect
102-
golang.org/x/text v0.32.0 // indirect
103107
golang.org/x/time v0.12.0 // indirect
104-
golang.org/x/tools v0.39.0 // indirect
108+
golang.org/x/tools v0.40.0 // indirect
105109
google.golang.org/protobuf v1.36.10 // indirect
106110
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
107111
gopkg.in/inf.v0 v0.9.1 // indirect
108-
gopkg.in/yaml.v3 v3.0.1 // indirect
109112
k8s.io/api v0.35.0 // indirect
110113
k8s.io/apimachinery v0.35.0 // indirect
111114
k8s.io/client-go v0.35.0 // indirect

0 commit comments

Comments
 (0)