You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/references/gofrcli/page.md
+37-37Lines changed: 37 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ The CLI can be run directly from the terminal after installation. Here’s the g
43
43
44
44
## 1. ***`init`***
45
45
46
-
The init command initializes a new GoFr project. It sets up the foundational structure for the project and generates a basic "Hello World!" program as a starting point. This allows developers to quickly dive into building their application with a ready-made structure.
46
+
The init command initializes a new GoFr project. It sets up the foundational structure for the project and generates a basic "Hello World!" program as a starting point. This allows developers to quickly dive into building their application with a ready-made structure.
47
47
48
48
### Command Usage
49
49
```bash
@@ -53,8 +53,8 @@ The CLI can be run directly from the terminal after installation. Here’s the g
53
53
54
54
## 2. ***`migrate create`***
55
55
56
-
The migrate create command generates a migration template file with pre-defined structure in your migrations directory.
57
-
This boilerplate code helps you maintain consistent patterns when writing database schema modifications across your project.
56
+
The migrate create command generates a migration template file with pre-defined structure in your migrations directory.
57
+
This boilerplate code helps you maintain consistent patterns when writing database schema modifications across your project.
58
58
59
59
60
60
### Command Usage
@@ -74,16 +74,16 @@ This command generates a migration directory which has the below files:
74
74
package migrations
75
75
76
76
import (
77
-
"gofr.dev/pkg/gofr/migration"
77
+
"gofr.dev/pkg/gofr/migration"
78
78
)
79
79
80
80
funccreate_employee_table() migration.Migrate {
81
-
return migration.Migrate{
82
-
UP: func(d migration.Datasource) error {
83
-
// write your migrations here
84
-
returnnil
85
-
},
86
-
}
81
+
return migration.Migrate{
82
+
UP: func(d migration.Datasource) error {
83
+
// write your migrations here
84
+
returnnil
85
+
},
86
+
}
87
87
}
88
88
```
89
89
2. An auto-generated all.go file that maintains a registry of all migrations:
> **💡 Best Practice:** Learn about [organizing migrations by feature](../../docs/advanced-guide/handling-data-migrations#organizing-migrations-by-feature) to avoid creating one migration per table or operation.
105
+
> **💡 Best Practice:** Learn about [organizing migrations by feature](../../advanced-guide/handling-data-migrations#organizing-migrations-by-feature) to avoid creating one migration per table or operation.
106
106
107
-
For detailed instructions on handling database migrations, see the [handling-data-migrations documentation](../../docs/advanced-guide/handling-data-migrations)
107
+
For detailed instructions on handling database migrations, see the [handling-data-migrations documentation](../../advanced-guide/handling-data-migrations)
108
108
For more examples, see the [using-migrations](https://github.com/gofr-dev/gofr/tree/main/examples/using-migrations)
109
109
---
110
110
111
111
## 3. ***`wrap grpc`***
112
112
113
-
* The gofr wrap grpc command streamlines gRPC integration in a GoFr project by generating GoFr's context-aware structures.
114
-
* It simplifies setting up gRPC handlers with minimal steps, and accessing datasources, adding tracing as well as custom metrics. Based on the proto file it creates the handler/client with GoFr's context.
115
-
For detailed instructions on using grpc with GoFr see the [gRPC documentation](../../advanced-guide/grpc/page.md)
113
+
* The gofr wrap grpc command streamlines gRPC integration in a GoFr project by generating GoFr's context-aware structures.
114
+
* It simplifies setting up gRPC handlers with minimal steps, and accessing datasources, adding tracing as well as custom metrics. Based on the proto file it creates the handler/client with GoFr's context.
115
+
For detailed instructions on using grpc with GoFr see the [gRPC documentation](../../advanced-guide/grpc)
116
116
117
117
### Command Usage
118
118
**gRPC Server**
@@ -314,7 +314,7 @@ gofr store generate
314
314
```
315
315
316
316
This generates:
317
-
```
317
+
```text
318
318
stores/
319
319
├── store.yaml # Central Configuration
320
320
├── all.go # Store registry factory (auto-generated)
@@ -383,7 +383,7 @@ models:
383
383
```
384
384
385
385
**Generated structure:**
386
-
```
386
+
```text
387
387
stores/
388
388
├── all.go
389
389
├── user/
@@ -399,9 +399,9 @@ stores/
399
399
**Using the registry with multiple stores:**
400
400
```go
401
401
import (
402
-
"your-project/stores"
403
-
"your-project/stores/user"
404
-
"your-project/stores/product"
402
+
"your-project/stores"
403
+
"your-project/stores/user"
404
+
"your-project/stores/product"
405
405
)
406
406
407
407
// stores.GetStore returns a factory-created instance
0 commit comments