Release v1.32.0
🚀 Features :
1. Support for SurrealDB as a Data Source
SurrealDB is now supported as a data source in GoFr. The following methods are supported:
type SurrealDB interface {
Query(ctx context.Context, query string, vars map[string]any) ([]any, error)
Create(ctx context.Context, table string, data any) (map[string]any, error)
Update(ctx context.Context, table string, id string, data any) (any, error)
Delete(ctx context.Context, table string, id string) (any, error)
Select(ctx context.Context, table string) ([]map[string]any, error)
HealthCheck(context.Context) (any, error)
}To integrate SurrealDB into your application, use the AddSurrealDB method in your main.go :
client := surrealdb.New(&surrealdb.Config{
Host: "localhost",
Port: 8000,
Username: "root",
Password: "root",
Namespace: "test_namespace",
Database: "test_database",
TLSEnabled: false,
})
app.AddSurrealDB(client)For more details, refer to our official documentation.
2. Built-in Metrics for gRPC Services
GoFr now includes in-built metrics for all gRPC server executions and interservice gRPC calls. We automatically capture metrics to measure the response time of gRPC server/clients.
- Prerequisites : gofr-cli version v0.4.0 must be installed.
- Use the following commands :
gofr wrap grpc server --proto=<path/to/proto/file>to generate GoFr's gRPC handlers.gofr wrap grpc client -proto=<path/to/proto/file>to generate GoFr's gRPC client.
- Refer the official documentation & examples to set up gRPC server/clients with in built logging, tracing and metrics support.
🛠️ Fixes :
1. Enhanced gRPC Logging
- Improved logs for interservice gRPC calls, now including:
- Trace ID: For better tracking of distributed requests.
- Status Code: Logs the response status of gRPC calls for easy debugging and issue resolution.