github gofr-dev/gofr v1.44.0

latest releases: v1.46.3, v1.46.2, v1.46.1...
2 months ago

v1.44.0

🚀 Features

🔹 Correlation ID Access in GoFr Context

GoFr now allows users to easily access the correlation ID via gofr.Context.

  • Retrieve correlation ID anywhere in your application using:

    ctx.GetCorrelationID()

🔹 Couchbase Support

GoFr now supports injecting Couchbase as a datasource. Any driver implementing the following interface can be added via app.AddCouchbase() and accessed across the application using gofr.Context.

🧩 Supported Couchbase Interface:

type Couchbase interface {
    Get(ctx context.Context, key string, result any) error
    Insert(ctx context.Context, key string, document, result any) error
    Upsert(ctx context.Context, key string, document any, result any) error
    Remove(ctx context.Context, key string) error
    Query(ctx context.Context, statement string, params map[string]any, result any) error
    AnalyticsQuery(ctx context.Context, statement string, params map[string]any, result any) error
}

✅ Example Usage:

a := gofr.New()

a.AddCouchbase(couchbase.New(&couchbase.Config{
    Host:     "localhost",
    User:     "Administrator",
    Password: "password",
    Bucket:   "test-bucket",
}))

📚 Documentation: Couchbase Setup Guide


🔹 OracleDB Support

GoFr now supports injecting OracleDB as a relational datasource via a clean and extensible interface.

🧩 Supported Oracle Interface:

type Oracle interface {
    Exec(ctx context.Context, query string, args ...any) error
    Select(ctx context.Context, dest any, query string, args ...any) error
}

This approach makes it easy to inject any compatible Oracle driver while maintaining flexibility to use multiple databases within your GoFr application.

✅ Example – Add OracleDB in GoFr

app.AddOracle(oracle.New(oracle.Config{
    Host:     "localhost",
    Port:     1521,
    Username: "system",
    Password: "YourPasswordHere",
    Service:  "FREEPDB1",
}))

📚 Documentation & Setup Guide: Oracle


🛠️ Fixes

  • Removed the unnecessary SQL initialization when no DB_* environment variables are defined. Prevents failure logs: connection to failed: host name is empty
  • Fixed issue where metrics showed infinite DB calls for every query.

Don't miss a new gofr release

NewReleases is sending notifications on new releases.