go-duck-cli 1.4.12 → 1.4.14
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/generators/kratos.js
CHANGED
|
@@ -37,12 +37,14 @@ export const generateKratosCode = async (entities, projectRootDir, projectName,
|
|
|
37
37
|
'integer': 'int32',
|
|
38
38
|
'long': 'int64',
|
|
39
39
|
'float': 'float',
|
|
40
|
+
'double': 'double',
|
|
40
41
|
'bigdecimal': 'double',
|
|
41
42
|
'bool': 'bool',
|
|
42
43
|
'boolean': 'bool',
|
|
43
44
|
'localdate': 'string',
|
|
44
45
|
'instant': 'string',
|
|
45
46
|
'datetime': 'string',
|
|
47
|
+
'time': 'string',
|
|
46
48
|
'text': 'string',
|
|
47
49
|
'json': 'string',
|
|
48
50
|
'jsonb': 'string'
|
|
@@ -62,7 +64,8 @@ export const generateKratosCode = async (entities, projectRootDir, projectName,
|
|
|
62
64
|
'int': 'int',
|
|
63
65
|
'integer': 'int',
|
|
64
66
|
'long': 'int64',
|
|
65
|
-
'float': '
|
|
67
|
+
'float': 'float32',
|
|
68
|
+
'double': 'float64',
|
|
66
69
|
'bigdecimal': 'float64',
|
|
67
70
|
'bool': 'bool',
|
|
68
71
|
'boolean': 'bool',
|
|
@@ -82,6 +85,7 @@ export const generateKratosCode = async (entities, projectRootDir, projectName,
|
|
|
82
85
|
'integer': 'int32',
|
|
83
86
|
'long': 'int64',
|
|
84
87
|
'float': 'float32',
|
|
88
|
+
'double': 'float64',
|
|
85
89
|
'bigdecimal': 'float64',
|
|
86
90
|
'json': 'string',
|
|
87
91
|
'jsonb': 'string'
|
package/generators/telemetry.js
CHANGED
|
@@ -262,7 +262,7 @@ func getContainerMemoryLimit() uint64 {
|
|
|
262
262
|
func getCgroupCPUUsageNs() (uint64, error) {
|
|
263
263
|
// try v2
|
|
264
264
|
if data, err := os.ReadFile("/sys/fs/cgroup/cpu.stat"); err == nil {
|
|
265
|
-
lines := strings.Split(string(data), "
|
|
265
|
+
lines := strings.Split(string(data), "\\n")
|
|
266
266
|
for _, line := range lines {
|
|
267
267
|
if strings.HasPrefix(line, "usage_usec") {
|
|
268
268
|
parts := strings.Fields(line)
|
package/package.json
CHANGED
|
@@ -1217,16 +1217,16 @@ func SetupRouter(appConfig *config.Config) *gin.Engine {
|
|
|
1217
1217
|
if (threadsGrid.children.length !== sys.cpu_threads_usage.length) {
|
|
1218
1218
|
let html = '';
|
|
1219
1219
|
sys.cpu_threads_usage.forEach((val, idx) => {
|
|
1220
|
-
html +=
|
|
1221
|
-
<canvas id="t-cpu-canvas
|
|
1222
|
-
<div id="t-cpu-label
|
|
1223
|
-
</div
|
|
1220
|
+
html += '<div class="cpu-chart-container" title="Core ' + idx + '">' +
|
|
1221
|
+
'<canvas id="t-cpu-canvas-' + idx + '" class="cpu-chart-canvas"></canvas>' +
|
|
1222
|
+
'<div id="t-cpu-label-' + idx + '" class="cpu-chart-label">T' + idx + ': 0%</div>' +
|
|
1223
|
+
'</div>';
|
|
1224
1224
|
});
|
|
1225
1225
|
threadsGrid.innerHTML = html;
|
|
1226
1226
|
|
|
1227
1227
|
// Set internal canvas resolution to match computed CSS size for crisp rendering
|
|
1228
1228
|
sys.cpu_threads_usage.forEach((val, idx) => {
|
|
1229
|
-
const canvas = document.getElementById(
|
|
1229
|
+
const canvas = document.getElementById('t-cpu-canvas-' + idx);
|
|
1230
1230
|
if (canvas) {
|
|
1231
1231
|
canvas.width = canvas.offsetWidth;
|
|
1232
1232
|
canvas.height = canvas.offsetHeight;
|
|
@@ -1246,13 +1246,13 @@ func SetupRouter(appConfig *config.Config) *gin.Engine {
|
|
|
1246
1246
|
}
|
|
1247
1247
|
|
|
1248
1248
|
// Render Text Label
|
|
1249
|
-
const label = document.getElementById(
|
|
1249
|
+
const label = document.getElementById('t-cpu-label-' + idx);
|
|
1250
1250
|
if (label) {
|
|
1251
|
-
label.innerText =
|
|
1251
|
+
label.innerText = 'T' + idx + ': ' + val.toFixed(0) + '%';
|
|
1252
1252
|
}
|
|
1253
1253
|
|
|
1254
1254
|
// Render Canvas Sparkline
|
|
1255
|
-
const canvas = document.getElementById(
|
|
1255
|
+
const canvas = document.getElementById('t-cpu-canvas-' + idx);
|
|
1256
1256
|
if (canvas) {
|
|
1257
1257
|
const ctx = canvas.getContext('2d');
|
|
1258
1258
|
const width = canvas.width;
|
|
@@ -65,10 +65,14 @@ func (s *{{capitalize name}}Service) Create{{capitalize name}}(ctx context.Conte
|
|
|
65
65
|
{{capitalize name}}: parseInstant(req.{{toProtoFieldName name}}),
|
|
66
66
|
{{else if (eq (toLowerCase type) "datetime")}}
|
|
67
67
|
{{capitalize name}}: parseInstant(req.{{toProtoFieldName name}}),
|
|
68
|
+
{{else if (eq (toLowerCase type) "time")}}
|
|
69
|
+
{{capitalize name}}: parseInstant(req.{{toProtoFieldName name}}),
|
|
68
70
|
{{else if (isJson type)}}
|
|
69
71
|
{{capitalize name}}: datatypes.JSON(req.{{toProtoFieldName name}}),
|
|
70
72
|
{{else if isNested}}
|
|
71
73
|
// Nested fields are mapped via JSON for simplicity in gRPC
|
|
74
|
+
{{else if (eq (toLowerCase type) "bigdecimal")}}
|
|
75
|
+
{{capitalize name}}: decimal.NewFromFloat(req.{{toProtoFieldName name}}),
|
|
72
76
|
{{else}}
|
|
73
77
|
{{capitalize name}}: {{#if (toGoCast type)}}{{toGoCast type}}(req.{{toProtoFieldName name}}){{else}}req.{{toProtoFieldName name}}{{/if}},
|
|
74
78
|
{{/if}}
|
|
@@ -179,10 +183,14 @@ func (s *{{capitalize name}}Service) Update{{capitalize name}}(ctx context.Conte
|
|
|
179
183
|
entity.{{capitalize name}} = parseInstant(req.{{toProtoFieldName name}})
|
|
180
184
|
{{else if (eq (toLowerCase type) "datetime")}}
|
|
181
185
|
entity.{{capitalize name}} = parseInstant(req.{{toProtoFieldName name}})
|
|
186
|
+
{{else if (eq (toLowerCase type) "time")}}
|
|
187
|
+
entity.{{capitalize name}} = parseInstant(req.{{toProtoFieldName name}})
|
|
182
188
|
{{else if (isJson type)}}
|
|
183
189
|
entity.{{capitalize name}} = datatypes.JSON(req.{{toProtoFieldName name}})
|
|
184
190
|
{{else if isNested}}
|
|
185
191
|
json.Unmarshal([]byte(req.{{toProtoFieldName name}}), &entity.{{capitalize name}})
|
|
192
|
+
{{else if (eq (toLowerCase type) "bigdecimal")}}
|
|
193
|
+
entity.{{capitalize name}} = decimal.NewFromFloat(req.{{toProtoFieldName name}})
|
|
186
194
|
{{else}}
|
|
187
195
|
entity.{{capitalize name}} = {{#if (toGoCast type)}}{{toGoCast type}}(req.{{toProtoFieldName name}}){{else}}req.{{toProtoFieldName name}}{{/if}}
|
|
188
196
|
{{/if}}
|
|
@@ -394,10 +402,14 @@ func map{{capitalize name}}ToPb(m *models.{{capitalize name}}) *pb.{{capitalize
|
|
|
394
402
|
{{toProtoFieldName name}}: m.{{capitalize name}}.Format(time.RFC3339),
|
|
395
403
|
{{else if (eq (toLowerCase type) "datetime")}}
|
|
396
404
|
{{toProtoFieldName name}}: m.{{capitalize name}}.Format(time.RFC3339),
|
|
405
|
+
{{else if (eq (toLowerCase type) "time")}}
|
|
406
|
+
{{toProtoFieldName name}}: m.{{capitalize name}}.Format(time.RFC3339),
|
|
397
407
|
{{else if (isJson type)}}
|
|
398
408
|
{{toProtoFieldName name}}: string(m.{{capitalize name}}),
|
|
399
409
|
{{else if isNested}}
|
|
400
410
|
{{toProtoFieldName name}}: (func() string { b, _ := json.Marshal(m.{{capitalize name}}); return string(b) })(),
|
|
411
|
+
{{else if (eq (toLowerCase type) "bigdecimal")}}
|
|
412
|
+
{{toProtoFieldName name}}: m.{{capitalize name}}.InexactFloat64(),
|
|
401
413
|
{{else}}
|
|
402
414
|
{{toProtoFieldName name}}: {{#if (toProtoCast type)}}{{toProtoCast type}}(m.{{capitalize name}}){{else}}m.{{capitalize name}}{{/if}},
|
|
403
415
|
{{/if}}
|
|
@@ -65,8 +65,7 @@ func getContainerMemoryLimit() uint64 {
|
|
|
65
65
|
func getCgroupCPUUsageNs() (uint64, error) {
|
|
66
66
|
// try v2
|
|
67
67
|
if data, err := os.ReadFile("/sys/fs/cgroup/cpu.stat"); err == nil {
|
|
68
|
-
lines := strings.Split(string(data), "
|
|
69
|
-
")
|
|
68
|
+
lines := strings.Split(string(data), "\n")
|
|
70
69
|
for _, line := range lines {
|
|
71
70
|
if strings.HasPrefix(line, "usage_usec") {
|
|
72
71
|
parts := strings.Fields(line)
|