Skip to content

v1.24.0

Compare
Choose a tag to compare
@aryanmehrotra aryanmehrotra released this 14 Oct 12:24
· 422 commits to main since this release
371c49a

Release v1.24.0

✨ Features:

  • Cassandra Tracing & Context Support:
    We’ve added context support and tracing for Cassandra operations, improving flexibility and observability. The following methods are now available:

    Single Operations:

    • QueryWithCtx: Executes queries with context, binding results to the specified destination.
    • ExecWithCtx: Executes non-query operations with context.
    • ExecCASWithCtx: Executes lightweight (CAS) transactions with context.
    • NewBatchWithCtx: Initializes a new batch operation with context.

    Batch Operations:

    • BatchQueryWithCtx: Adds queries to batch operations with context.
    • ExecuteBatchWithCtx: Executes batch operations with context.
    • ExecuteBatchCASWithCtx: Executes batch operations with context and returns the result.

    Note: The following methods in Cassandra have been deprecated:

    type Cassandra interface {
        Query(dest interface{}, stmt string, values ...any) error
        Exec(stmt string, values ...any) error
        ExecCAS(dest any, stmt string, values ...any) (bool, error)
        BatchQuery(stmt string, values ...any) error
        NewBatch(name string, batchType int) error
        CassandraBatch
    }
    
    type CassandraBatch interface {
        BatchQuery(name, stmt string, values ...any)
        ExecuteBatch(name string) error
        ExecuteBatchCAS(name string, dest ...any) (bool, error)
    }
  • JWT Claims Retrieval:
    OAuth-enabled applications can now retrieve JWT claims directly within handlers. Here’s an example:

    func HelloHandler(c *gofr.Context) (interface{}, error) {
        // Retrieve the JWT claim from the context
        claimData := c.Context.Value(middleware.JWTClaim)
    
        // Assert that the claimData is of type jwt.MapClaims
        claims, ok := claimData.(jwt.MapClaims)
        if !ok {
            return nil, fmt.Errorf("invalid claim data type")
        }
    
        // Return the claims as a response
        return claims, nil
    }

🛠️ Fixes:

  • Redis Panic Handling:
    Resolved an issue where calling Redis.Ping() without an active connection caused the application to panic. This is now handled gracefully.

  • Docker Example Enhancement:
    The http-server example has been enhanced to include Prometheus and Grafana containers in its Docker setup, allowing users to fully explore GoFr's observability features.