Skip to content

v1.27.0

Compare
Choose a tag to compare
@aryanmehrotra aryanmehrotra released this 15 Nov 11:33
· 114 commits to main since this release
9990977

Release v1.27.0

✨ Features

  1. UseMiddlewareWithContainer for Custom Middleware with Container Access
    Introduced the UseMiddlewareWithContainer method, which allows custom middleware to access the application's container. This provides access to essential services such as logging, configuration, and database instances, enabling middleware to modify request processing dynamically.

    Example Usage:

    import (
        "fmt"
        "net/http"
    
        "gofr.dev/pkg/gofr"
        "gofr.dev/pkg/gofr/container"
    )
    
    func main() {
        // Create a new GoFr application instance
        a := gofr.New()
    
        // Add custom middleware with container access
        a.UseMiddlewareWithContainer(customMiddleware)
    
       ....
    }
    
    // Define middleware with container access
    func customMiddleware(c *container.Container, handler http.Handler) http.Handler {
        return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
            c.Logger.Log("Hey! Welcome to GoFr")
            handler.ServeHTTP(w, r)
        })
    }
    ` 
  2. Migrations Support in MongoDB
    GoFr now introduces support for data migrations in MongoDB, enabling seamless modifications to your database schema and data. This includes adding new fields, modifying data types of existing fields, setting or removing indexes, and applying constraints to collections. All changes are meticulously tracked in the GoFr Migrations Table, ensuring a reliable and auditable history of database updates.


🛠️ Fixes

  1. Remote Log URL Setup
    Resolved an issue where logs fetched from the remote log URL were missing correlation IDs. Logs now consistently include the correlation ID, ensuring better traceability.

  2. Entity DataType Documentation Update
    Enhanced the documentation for the Add-rest-handler feature by specifying supported data types in the entity structure, improving usability and reducing confusion.

  3. SQL Logs Level Adjustment
    Fixed the log level for successful SQL connections, which was mistakenly set to debug. It is now appropriately logged at the info level, aligning with logging best practices.