Releases: gofr-dev/gofr-cli
v0.7.1
v0.7.1
🔧 Fixes
1. Preserve Existing Mappings in all.go
During Migration Generation
The migrate
command previously overwrote the all.go
file completely, causing renamed or manually modified entries to be lost. This fix updates the behavior to ensure a safer and non-destructive migration experience.
🔧 New Behavior:
- Existing mappings in
all.go
are left unchanged. - Renamed migration files do not cause all.go to be overwritten.
- Only new migration files—identified by timestamp-based filenames not yet present—are appended to
all.go
.
This fix ensures reliable migration file management without disrupting existing mappings or manual edits.
v0.7.0
Release v0.7.0
🚀 Feature
gRPC Streaming Support
-
Added comprehensive support for all gRPC streaming types:
- Server-side streaming
- Client-side streaming
- Bidirectional streaming
-
Generated code includes proper instrumentation for streaming methods with built-in observability for streaming calls including metrics and tracing
-
Refer to the official documentation & examples to know more about implementing gRPC streaming services and clients with GoFr.
v0.6.0
Release v0.6.0
🚀 Improvements
Configurable gRPC Client Connections
- gRPC client connections in GoFr are now more flexible!
- Users can now pass custom
DialOptions
when setting up gRPC clients, enabling advanced use cases like setting interceptors, timeouts, TLS credentials, and more. - The newly generated gRPC client template has been updated to support variadic parameters, making it easy to plug in additional configurations.
📖 Learn how to use this feature through our official docs: Customizing gRPC Clients with DialOptions
🛠 Fixes
1. Duplicate Generated Definitions in gRPC Services
- Previously, gRPC services using the same message types across different services led to duplicated and conflicting code in the generated client package. GoFr-CLI now handles message types independently, ensuring clean and conflict-free code generation.
v0.5.0
Release v0.5.0
🚀 Features
-
Default HealthChecks for gRPC Servers:
-
All newly generated gRPC servers now come with default HealthChecks implemented.
-
This ensures that the server's health status can be monitored out of the box without additional configuration.
-
-
Cross-Server Health Monitoring:
-
All generated gRPC clients now include default methods to check the health of other gRPC servers.
-
This enhancement facilitates better inter-service communication and improves reliability in distributed systems.
-
For more details, refer to the official documentation and explore the examples' repo.
v0.4.0
Release v0.4.0
🚀 Features
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.
-
gRPC Server Registration
-
Use the
gofr wrap grpc server -proto=<path/to/proto/file>
to generate the GoFr's gRPC handlers. -
Simplify the registration of a gRPC server using the
Register{ServiceName}ServerWithGofr
method:func main(){ app := gofr.New() {packageName}.Register{ServiceName}ServerWithGofr(app, &packageName.{ServiceName}GoFrServer{}) app.Run() }
-
-
gRPC Client Registration
-
Use the
gofr wrap grpc client -proto=<path/to/proto/file>
to generate the GoFr's gRPC client. -
Easily create and register gRPC clients with the
New{ServiceName}GoFrClient
method:func main(){ app:= gofr.New() gRPCClient, err := {clientPackage}.New{serviceName}GoFrClient(app.Config.Get("GRPC_SERVER_HOST", app.Metrics())) if err != nil { app.Logger().Errorf("Failed to create gRPC client: %v", err) return } app.Run() }
-
Use the registered client to make interservice gRPC calls.
-
Refer to the official documentation & examples to know more.
🛠️ Fixes & Improvements
- 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.
- Improved logs for interservice gRPC calls, now including:
v0.3.0
GoFr CLI v0.3.0
Feature:
Enable Interservice gRPC Call Tracing
The gofr wrap grpc client
command generates gRPC handlers and servers with GoFr's context support. This change ensures clarity in the command's role and functionality.
Command Syntax:
gofr wrap grpc client --proto=<path_to_your_proto_file>
The {serviceName}_client.go
file is auto-generated in the same directory as that of your proto file. It should not be modified.
Example:
After generating the {serviceName}_client.go
in file, you can register and access the gRPC service as follows:
func main() {
app := gofr.New()
// Create a gRPC client for the Hello service
helloGRPCClient, err := {clientPackage}.NewHelloGoFrClient(app.Config.Get("GRPC_SERVER_HOST"))
if err != nil {
app.Logger().Errorf("Failed to create Hello gRPC client: %v", err)
return
}
greetHandler := NewGreetHandler(helloGRPCClient)
// Register HTTP endpoint for Hello service
app.GET("/hello", greetHandler.Hello)
// Run the application
app.Run()
}
Calling the registered gRPC Service :
The generated service can be accessed as follows:
type GreetHandler struct {
helloGRPCClient client.HelloGoFrClient
}
func NewGreetHandler(helloClient client.HelloGoFrClient) *GreetHandler {
return &GreetHandler{
helloGRPCClient: helloClient,
}
}
func (g GreetHandler) Hello(ctx *gofr.Context) (interface{}, error) {
// Make a gRPC call to the Hello service
helloResponse, err := g.helloGRPCClient.SayHello(ctx, &client.HelloRequest{Name: userName})
if err != nil {
return nil, err
}
return helloResponse, nil
}
Fixes & Improvements
-
Command Update:
- The command
gofr wrap grpc
has been changed togofr wrap grpc server
to better reflect its purpose of generating gRPC handlers and servers with GoFr's context support. - The argument remains unchanged:
--proto=<path_to_your_proto_file>
.
- The command
-
GoFr-CLI Documentation Update:
- The GoFr-CLI README now provides a comprehensive guide to all available commands, serving as the one-stop solution for understanding GoFr-CLI functionality.
v0.2.1
Release Notes
🛠️ Fixes
-
Use snakecase for file names for files generated for gRPC Handlers
Thegofr wrap grpc
command now follows standardized file naming conventions by generating files in snake_case.Based on
{serviceName}.pb.go
and{serviceName}_grpc.pb.go
, the command now creates{serviceName}_gofr.go
and{serviceName}_server.go
for improved consistency and alignment with best practices.To know how to set up gRPC GoFr Handlers using our cli refer: setting up gRPC Handlers
v0.2.0
GoFr CLI v0.2.0
gofr Context Support for gRPC Handlers
The gofr wrap grpc
command introduces seamless integration of gofr's context in gRPC handlers.
Command:
gofr wrap grpc
- Flags
-proto=<path_to_the_proto_file>
Generated Files:
- Example Structure of
{serviceName}Server.go
file {serviceName}.gofr.go
(auto-generated; do not modify)
{serviceName}Server.go File:
package hello
import "gofr.dev/pkg/gofr"
// Register the gRPC service in main.go:
// hello.RegisterHelloServerWithGofr(app, &grpc.HelloGoFrServer{})
type HelloGoFrServer struct {}
func (s *HelloGoFrServer) SayHello(ctx *gofr.Context) (any, error) {
// Optionally bind request payload
// var request HelloRequest
// if err := ctx.Bind(&request); err != nil {
// return nil, err
// }
return &HelloResponse{}, nil
}
Extend HelloGoFrServer
as needed for your gofr application.
v0.1.1
Release v0.1.1
Bug Fixes
- Fixed the issue with the migration name containing
_
causing issues with theall.go
and migration name.
Full Changelog: v0.1.0...v0.1.1
v0.1.0
Release v0.1.0
👀 Overview
This is the initial release of our CLI tool, built on top of the GoFr. This version provides basic functionality for:
- init: Generating a project template with essential files and structures.
- migrate: Creating a template for database migrations.
- version: Displaying the current version of the CLI tool.
✨ Features
-
Project template
Generation of a basic project structure with hello endpoint built on gofr, including mod files and main package.
Example: init -name=hello-world -
Migrations template
Generation of migrations directory with given migration file.
Example: migrate create -name=create_table_users