v1.28.0
Umang01-hash
released this
27 Nov 12:51
·
119 commits
to development
since this release
✨ Features:
Custom Response Headers Support:
Users can add custom HTTP response headers using the Response
struct. This feature helps add extra information, such as security policies or other metadata, to improve communication between clients and servers.
- Example usage:
return response.Response{ Data: "Hello World from new Server", Headers: map[string]string{"X-Custom-Header": "CustomValue", "X-Another-Header": "AnotherValue"}, }`
OpenTSDB Support:
Users can integrate OpenTSDB to store and retrieve time-series data.
-
Methods include:
PutDataPoints
: Send data to OpenTSDB.QueryDataPoints
: Retrieve data based on specified parameters.GetAggregators
: Get available aggregation functions.QueryAnnotation
,PostAnnotation
,PutAnnotation
,DeleteAnnotation
: Manage annotations in OpenTSDB.
-
To import GoFr's external OpenTSDB driver:
go get gofr.dev/pkg/gofr/datasource/opentsdb@latest
type OpenTSDB interface {
HealthChecker
PutDataPoints(ctx context.Context, data any, queryParam string, res any) error
QueryDataPoints(ctx context.Context, param any, res any) error
QueryLatestDataPoints(ctx context.Context, param any, res any) error
GetAggregators(ctx context.Context, res any) error QueryAnnotation(ctx context.Context, queryAnnoParam map[string]any, res any) error
PostAnnotation(ctx context.Context, annotation any, res any) error
PutAnnotation(ctx context.Context, annotation any, res any) error
DeleteAnnotation(ctx context.Context, annotation any, res any) error
}
- For more info, checkout the documentation: https://gofr.dev/docs/advanced-guide/injecting-databases-drivers#open-tsdb
Support for Binding Binary/Octet Stream:
Users can bind binary/octet-stream
content directly to []byte
slices using GoFr context.
-
Example usage:
var result []byte err := req.Bind(&result) if err != nil { log.Fatalf("Bind error: %v", err) }
🛠️ Fixes:
Milliseconds Logged as Microseconds:
- Previously, operation duration was calculated in milliseconds but was incorrectly logged as microseconds, which led to confusion. This has been fixed to ensure that logs display the accurate duration in microseconds.
Dgraph Datasource Panic Fix
- Fixed an issue where the Dgraph datasource would panic due to an uninitialized tracer when added as an external datasource. This bug has been addressed.
Solr Methods Fixes:
- Fixed errors occurring in the following Solr datasource methods:
Update
,Delete
,ListFields
,Retrieve
,AddField
,UpdateField
,DeleteField
. - Updated documentation and provided a working example, accordingly.
Deprecated UseMiddlewareWithContainer
Method:
- The method
UseMiddlewareWithContainer
has been deprecated and will be removed in future releases. Developers should use the*App.UseMiddleware
method instead, which does not depend on the container.
Static File Path Handling Fix:
- Fixed an issue in the
AddStaticFiles
method where file paths were not correctly resolved when they didn't start with./
or were not absolute paths. The fix ensures that the correct file path is registered for static file serving.