Releases: gofr-dev/gofr
v1.18.0
Release v1.18.0
✨ Features
-
SQL Tags in AddRESTHandlers
TheAddRESTHandlers
function now supports the following SQL tags for enhanced data integrity and database handling:auto_increment
:
When this tag is applied to a struct field, any provided ID value will be ignored. Instead, the ID returned by the database after insertion will be used.not_null
:
This tag enforces a non-null constraint at the service level, ensuring that no nil value can be sent for the specified field.
Incase nil value is sent, error will be returned.
Example:
type user struct { ID int `json:"id" sql:"auto_increment"` Name string `json:"name" sql:"not_null"` Age int `json:"age"` IsEmployed bool `json:"isEmployed"` }
-
Added support for directory operations in FileSystem
Supported functionalities are:
ChDir(dirname string) error
- ChDir changes the current directory.
Getwd() (string, error)
- Getwd returns the path of the current directory.
ReadDir(dir string) ([]FileInfo, error)
- ReadDir returns a list of files/directories present in the directory.
Stat(name string) (FileInfo, error)
- Stat returns the file/directory information in the directory.
🛠 Enhancements
-
Error logs for invalid configs
Added validations forREQUEST_TIMEOUT
andREMOTE_LOG_FETCH_INTERVAL
configs and log error if invalid. -
Error logs for internal server errors
Previously, if any occurred then there was a log with just status code and correlationID.
Hence, added an error log with correlationID anderror message
.
-
FileSystem mock methods for testing purpose
To help test the FileSystem methods, mocks have now been added to mock container struct which can be generated fromNewMockContainer
method.
🐞 Fixes
-
Resolved application status in case of migration failure
If any occurs while running the migrations, the application will now gracefullyshutdown
. -
Resolved response for error case
For an error case, where the response consists of error message only and has no data to return, then also the data field was present in output asnull
.
This has been removed now, so only error struct will be returned with respective status code.
v1.17.0
Release v1.17.0
✨ Features
-
Added support for FTP as an external datasource
FTP can be added using the method on gofrAppAddFTP(fs file.FileSystemProvider)
Supported functionalities are:
Create(name string) (File, error)
Mkdir(name string, perm os.FileMode) error
MkdirAll(path string, perm os.FileMode) error
Open(name string) (File, error)
OpenFile(name string, flag int, perm os.FileMode) (File, error)
Remove(name string) error
RemoveAll(path string) error
Rename(oldName, newName string) error
-
Cassandra now supports Batching
Added Batch functionality with newly introduced methods:
NewBatch(batchType int) error
BatchQuery(stmt string, values ...interface{})
ExecuteBatch() error
-
Automated injection of
gofr.Context
in the gRPC server during registering of the gRPC service
gRPC can now inject gofrcontainer
to theServer
struct, to access logger, datasources, and other functionalities provided by gofr.
Refer to example for detailed info.
🛠 Enhancements
- Messages can now be written to WebSocket without returning
Added method on gofrContextWriteMessageToSocket(data any) error
to write a message.
🐞 Fixes
-
Resolved panic for EnableBasicAuth
If an odd no. of arguments (user, password) were passed to theEnableBasicAuth
method, the app panicked. Fixed this issue, user and password can be passed in the method as comma-separated pairs like:
EnableBasicAuth(user1, pass1, user2, pass2)
-
Resolved authentication for EnableBasicAuth
Even if the credentials were correct, the app was returning the401
status Unauthorised instead of the expected200
. -
Fixed unstructured log in Mongo
Debug query logs were not properly formatted for Mongo, fixed the formatting.
Themessage
field in logs wasstring
type, updated it toobject
v1.16.1
Release v1.16.1
🐞 Fixes
- Resolved DB migrations panic in logging
App was panicking while logging with migrations datasource, as the logger wasnil
. Now, populated the logger, hence fixing the panic. - Removed unexpected error log for tracing when it was not enabled from configs
{"level":"ERROR","time":"2024-08-06T17:47:56.714963+05:30","message":"unsupported TRACE_EXPORTER: ","gofrVersion":"v1.16.0"}
The above log was printed when tracing configs (TRACE_EXPORTER, TRACER_URL) weren't provided, and since tracing is optional feature, removed error log if configs aren't given.
v1.16.0
Release v1.16.0
✨ Features
-
Application will now gracefully shutdown to prevent data loss during application termination
All the processes (go-routines) will be awaited to finish before shutting down. Currently, the timeout for shutdown is30 seconds
. Will be making it configurable in upcoming release. -
Enhanced query parameter handling to support multiple values
Previously, only a single value was supported for query params withParam(key string) string
method. Now, added another methodParams(key string) []string
which returns array of values passed for given query param.
Example:If URL is - http://order-service/orders?id=123,234 - http://order-service/orders?id=123&id=234 Then ctx.Params("id") will return ["123", "234"]
-
Enhanced security with SSL support for PostgreSQL connections
Default certificates can now be used as SSL, by configuringDB_SSL_MODE
asrequire
.
Currently this is only supported with PostgreSQL. Custom certificates and other DBs will be supported in future releases.
🛠 Enhancements
-
Improved logging for tracer configs validation
Tracing is only enabled whenboth
TRACE_EXPORTER and TRACER_URL are provided, so added error logs if any one of them is provided and the other is missing. -
Improved tracing with OpenTelemetry protocol integration
Tracing can now be configured as otel protocol by configuringTRACE_EXPORTER
asotlp
, and providingTRACER_URL
.
🐞 Fixes
- Resolved panic caused by passing non-pointer objects in AddRESTHandlers method
App was panicking while initialising if the argument is passed by value toAddRESTHandlers
method. Since, the method only accepts arguments passed by reference, added validations and error log instead of panic.
v1.15.0
v1.14.1
v1.14.0
This version contains breaking changes, please use v1.14.1
Release v1.14.0
✨ Features
-
Add support for auth header for tracer exporter (#828)
Authorization header can be passed for tracer usingTRACER_AUTH_KEY
config -
Add support for custom tracer URL (#834)
Traces can now be posted to custom URL provided inTRACER_URL
config
NOTE: TRACER_HOST
and TRACER_PORT
are now deprecated, use TRACER_URL
instead.
Changelog: v1.13.0...v1.14.0
v1.13.0
✨ Features
- Add support for profilling endpoints. (#774)
- Add support for MQTT_KEEP_ALIVE. (#771)
- Support transactions in MongoDB driver. (#779)
- Add support for retry of failing downstream calls. (#778)
🐞 Fixes
- Fix MQTT messages being lost due to connection loss. (#771)
- Fix request timeout for health check calls. (#777)
- Fix dependent integration test in pub-sub example. (#784)
- Fix MQTT tests using mock Client and mock Token. (#791)
Changelog: v1.12.0...v1.13.0
v1.12.0
Release v1.12.0
✨ Features
- Add support of migrations for ClickHouse DB. (#750)
- Add support for serving static files. (#674)
- Add support of mocks for external datasources. (#749)
🛠 Enhancements
- Update GO version to
v1.22
(#741)
NOTE: Starting this version, supported GO versions are >=v1.21
🐞 Fixes
- Fix response of remote logging service. (#770)
- Fix nil metrics issue for error cases. (#761)
- Fix go.mod for examples. (#767)