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.