go-duck-cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +130 -0
- package/generators/cache.js +107 -0
- package/generators/config.js +173 -0
- package/generators/devops.js +212 -0
- package/generators/docs.js +74 -0
- package/generators/graphql.js +38 -0
- package/generators/kratos.js +157 -0
- package/generators/logger.js +68 -0
- package/generators/metering.js +143 -0
- package/generators/migrations.js +240 -0
- package/generators/mqtt.js +87 -0
- package/generators/multitenancy.js +130 -0
- package/generators/postgrest.js +115 -0
- package/generators/repository.js +28 -0
- package/generators/resilience.js +69 -0
- package/generators/security.js +168 -0
- package/generators/swagger.js +145 -0
- package/generators/telemetry.js +121 -0
- package/generators/websocket.js +162 -0
- package/index.js +592 -0
- package/package.json +23 -0
- package/parser/gdl.js +162 -0
- package/templates/application.yml.hbs +18 -0
- package/templates/docs/gin_bottle.png +0 -0
- package/templates/docs/index.html.hbs +226 -0
- package/templates/docs/intro.mp4 +0 -0
- package/templates/docs/kratos_mark.png +0 -0
- package/templates/docs/layout.hbs +106 -0
- package/templates/docs/logo.png +0 -0
- package/templates/docs/pages/audit.hbs +39 -0
- package/templates/docs/pages/cli.hbs +83 -0
- package/templates/docs/pages/gdl.hbs +223 -0
- package/templates/docs/pages/graphql.hbs +51 -0
- package/templates/docs/pages/grpc.hbs +100 -0
- package/templates/docs/pages/index.hbs +181 -0
- package/templates/docs/pages/integrations.hbs +83 -0
- package/templates/docs/pages/observability.hbs +34 -0
- package/templates/docs/pages/realtime.hbs +43 -0
- package/templates/docs/pages/rest.hbs +149 -0
- package/templates/docs/pages/security.hbs +31 -0
- package/templates/go/controller.go.hbs +236 -0
- package/templates/go/entity.go.hbs +34 -0
- package/templates/go/enum.go.hbs +7 -0
- package/templates/go/main.go.hbs +186 -0
- package/templates/graphql/resolver.go.hbs +50 -0
- package/templates/graphql/schema.graphql.hbs +64 -0
- package/templates/kratos/service.go.hbs +104 -0
- package/templates/proto/entity.proto.hbs +95 -0
- package/test_parser.js +9 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package api.v1;
|
|
4
|
+
|
|
5
|
+
import "google/api/annotations.proto";
|
|
6
|
+
import "google/protobuf/timestamp.proto";
|
|
7
|
+
|
|
8
|
+
option go_package = "{{projectName}}/api/v1;v1";
|
|
9
|
+
|
|
10
|
+
service {{capitalize name}}Service {
|
|
11
|
+
rpc Create{{capitalize name}} (Create{{capitalize name}}Request) returns ({{capitalize name}}Reply) {
|
|
12
|
+
option (google.api.http) = {
|
|
13
|
+
post: "/v1/{{lower name}}"
|
|
14
|
+
body: "*"
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
rpc Update{{capitalize name}} (Update{{capitalize name}}Request) returns ({{capitalize name}}Reply) {
|
|
18
|
+
option (google.api.http) = {
|
|
19
|
+
put: "/v1/{{lower name}}/{id}"
|
|
20
|
+
body: "*"
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
rpc Delete{{capitalize name}} (Delete{{capitalize name}}Request) returns (Delete{{capitalize name}}Reply) {
|
|
24
|
+
option (google.api.http) = {
|
|
25
|
+
delete: "/v1/{{lower name}}/{id}"
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
rpc Get{{capitalize name}} (Get{{capitalize name}}Request) returns ({{capitalize name}}Reply) {
|
|
29
|
+
option (google.api.http) = {
|
|
30
|
+
get: "/v1/{{lower name}}/{id}"
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
rpc List{{capitalize name}} (List{{capitalize name}}Request) returns (List{{capitalize name}}Reply) {
|
|
34
|
+
option (google.api.http) = {
|
|
35
|
+
get: "/v1/{{lower name}}"
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
message {{capitalize name}} {
|
|
41
|
+
uint64 id = 1;
|
|
42
|
+
{{#each fields}}
|
|
43
|
+
{{toProtoType type}} {{name}} = {{add @index 2}};
|
|
44
|
+
{{/each}}
|
|
45
|
+
google.protobuf.Timestamp created_at = 100;
|
|
46
|
+
google.protobuf.Timestamp updated_at = 101;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
message Create{{capitalize name}}Request {
|
|
50
|
+
{{#each fields}}
|
|
51
|
+
{{toProtoType type}} {{name}} = {{add @index 1}};
|
|
52
|
+
{{/each}}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
message Update{{capitalize name}}Request {
|
|
56
|
+
uint64 id = 1;
|
|
57
|
+
{{#each fields}}
|
|
58
|
+
{{toProtoType type}} {{name}} = {{add @index 2}};
|
|
59
|
+
{{/each}}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
message Delete{{capitalize name}}Request {
|
|
63
|
+
uint64 id = 1;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
message Delete{{capitalize name}}Reply {
|
|
67
|
+
string message = 1;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
message Get{{capitalize name}}Request {
|
|
71
|
+
uint64 id = 1;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
message {{capitalize name}}Reply {
|
|
75
|
+
{{capitalize name}} data = 1;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
message List{{capitalize name}}Request {
|
|
79
|
+
int32 page = 1;
|
|
80
|
+
int32 page_size = 2;
|
|
81
|
+
string query = 3;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
message List{{capitalize name}}Reply {
|
|
85
|
+
repeated {{capitalize name}} results = 1;
|
|
86
|
+
int64 total = 2;
|
|
87
|
+
}
|
|
88
|
+
{{#each enums}}
|
|
89
|
+
enum {{capitalize name}} {
|
|
90
|
+
{{capitalize name}}_UNSPECIFIED = 0;
|
|
91
|
+
{{#each values}}
|
|
92
|
+
{{capitalize ../name}}_{{this}} = {{add @index 1}};
|
|
93
|
+
{{/each}}
|
|
94
|
+
}
|
|
95
|
+
{{/each}}
|
package/test_parser.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
|
|
3
|
+
const content = fs.readFileSync('../GDL/app.gdl', 'utf8');
|
|
4
|
+
const relRegex = /relationship\s+(\w+)\s*\{([^}]*)\}/g;
|
|
5
|
+
let match;
|
|
6
|
+
while ((match = relRegex.exec(content)) !== null) {
|
|
7
|
+
console.log('Type:', match[1]);
|
|
8
|
+
console.log('Block:', match[2]);
|
|
9
|
+
}
|