go-duck-cli 1.0.8 → 1.1.1
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 +30 -15
- package/generators/ai_docs.js +130 -0
- package/generators/broker.js +63 -0
- package/generators/config.js +149 -7
- package/generators/devops.js +210 -43
- package/generators/docs.js +23 -4
- package/generators/elasticsearch.js +263 -0
- package/generators/kratos.js +229 -41
- package/generators/metering.js +280 -48
- package/generators/migrations.js +92 -198
- package/generators/mqtt.js +2 -39
- package/generators/multitenancy.js +274 -71
- package/generators/nats.js +39 -0
- package/generators/outbox.js +171 -0
- package/generators/postgrest.js +7 -3
- package/generators/postman.js +405 -0
- package/generators/repository.js +27 -0
- package/generators/router.js +27 -0
- package/generators/security.js +95 -14
- package/generators/serverless.js +147 -0
- package/generators/storage.js +589 -0
- package/generators/swagger.js +84 -60
- package/generators/telemetry.js +23 -32
- package/generators/websocket.js +55 -21
- package/index.js +481 -116
- package/package.json +6 -4
- package/parser/gdl.js +163 -24
- package/templates/docs/index.html.hbs +5 -5
- package/templates/docs/layout.hbs +221 -62
- package/templates/docs/pages/audit.hbs +83 -35
- package/templates/docs/pages/cli.hbs +18 -0
- package/templates/docs/pages/configuration.hbs +241 -0
- package/templates/docs/pages/datadog.hbs +46 -0
- package/templates/docs/pages/elasticsearch.hbs +121 -0
- package/templates/docs/pages/federation.hbs +241 -0
- package/templates/docs/pages/gdl-advanced.hbs +91 -0
- package/templates/docs/pages/gdl-annotations.hbs +137 -0
- package/templates/docs/pages/gdl-entities.hbs +134 -0
- package/templates/docs/pages/gdl-relationships.hbs +80 -0
- package/templates/docs/pages/gdl.hbs +60 -204
- package/templates/docs/pages/graphql.hbs +58 -44
- package/templates/docs/pages/grpc.hbs +53 -90
- package/templates/docs/pages/hybrid-store.hbs +127 -0
- package/templates/docs/pages/index.hbs +418 -149
- package/templates/docs/pages/keycloak.hbs +43 -0
- package/templates/docs/pages/legend.hbs +116 -0
- package/templates/docs/pages/mosquitto.hbs +39 -0
- package/templates/docs/pages/multitenancy.hbs +139 -71
- package/templates/docs/pages/otel.hbs +40 -0
- package/templates/docs/pages/realtime.hbs +38 -12
- package/templates/docs/pages/redis.hbs +40 -0
- package/templates/docs/pages/rest.hbs +120 -202
- package/templates/docs/pages/saga.hbs +94 -0
- package/templates/docs/pages/security.hbs +150 -44
- package/templates/docs/pages/serverless.hbs +157 -0
- package/templates/docs/pages/storage.hbs +127 -0
- package/templates/docs/pages/wizard.hbs +683 -0
- package/templates/docs/triple_identity_registry.png +0 -0
- package/templates/go/controller.go.hbs +287 -283
- package/templates/go/entity.go.hbs +17 -15
- package/templates/go/main.go.hbs +47 -180
- package/templates/go/migrator.go.hbs +65 -0
- package/templates/go/router.go.hbs +272 -0
- package/templates/graphql/resolver.go.hbs +53 -34
- package/templates/graphql/schema.graphql.hbs +17 -5
- package/templates/kratos/service.go.hbs +169 -34
- package/templates/proto/entity.proto.hbs +10 -14
- package/test_nested.gdl +21 -0
- package/templates/docs/intro.mp4 +0 -0
- package/test_parser.js +0 -9
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<div class="prose prose-slate max-w-none">
|
|
2
|
+
<!-- Relationships Hero -->
|
|
3
|
+
<div class="flex items-center space-x-3 mb-10 text-purple-700">
|
|
4
|
+
<div class="p-4 bg-gradient-to-br from-purple-600 to-purple-800 rounded-3xl shadow-xl shadow-purple-100">
|
|
5
|
+
<svg class="w-10 h-10 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
6
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1" />
|
|
7
|
+
</svg>
|
|
8
|
+
</div>
|
|
9
|
+
<div>
|
|
10
|
+
<h1 class="text-4xl font-black text-slate-900 m-0 tracking-tight leading-none">Relationships</h1>
|
|
11
|
+
<p class="text-purple-600 font-bold tracking-widest uppercase text-[10px] mt-2 ml-1">Entity Associations & Integrity</p>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<p class="text-xl text-slate-600 mb-12 italic leading-relaxed">
|
|
16
|
+
GDL makes modeling complex distributed associations trivial. Relations are defined outside of the entity blocks to maintain a clean, declarative architectural blueprint.
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<!-- Syntax Overview -->
|
|
20
|
+
<div class="bg-purple-900 rounded-[2.5rem] p-12 text-white shadow-2xl relative overflow-hidden group mb-16">
|
|
21
|
+
<div class="absolute inset-0 bg-gradient-to-br from-indigo-900/40 to-transparent"></div>
|
|
22
|
+
<div class="relative z-10">
|
|
23
|
+
<h2 class="text-3xl font-black mb-6 text-white m-0">The Social Network of Data</h2>
|
|
24
|
+
<div class="bg-purple-800/50 backdrop-blur-md rounded-2xl p-8 border border-purple-500/30">
|
|
25
|
+
<pre class="text-indigo-200 font-mono text-base leading-relaxed overflow-x-auto m-0">
|
|
26
|
+
<span class="text-purple-400">// relationship Type Parent to Child</span>
|
|
27
|
+
relationship 1:m Customer to Order
|
|
28
|
+
relationship m:1 Order to Customer
|
|
29
|
+
</pre>
|
|
30
|
+
</div>
|
|
31
|
+
<p class="mt-8 text-purple-200 text-sm italic font-medium leading-relaxed m-0 border-l-2 border-purple-400 pl-6">
|
|
32
|
+
Relationships in GO-DUCK are directional. The generator automatically injects foreign keys, GORM preloading logic, and Protobuf nested objects based on these declarations.
|
|
33
|
+
</p>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<!-- REL TYPES -->
|
|
38
|
+
<section class="mb-20">
|
|
39
|
+
<h2 class="text-3xl font-black text-slate-900 mb-8 tracking-tight">Supported Association Types</h2>
|
|
40
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-8">
|
|
41
|
+
<div class="p-8 bg-white border border-slate-200 rounded-[2rem] shadow-sm hover:border-purple-200 transition-all group">
|
|
42
|
+
<div class="w-12 h-12 bg-purple-100 rounded-xl flex items-center justify-center mb-6 text-2xl group-hover:scale-110 transition-transform">👨👩👧</div>
|
|
43
|
+
<h3 class="text-xl font-bold text-slate-900 mb-4 m-0 font-mono">1:m (One-to-Many)</h3>
|
|
44
|
+
<p class="text-sm text-slate-600 leading-relaxed mb-6 italic">One parent entity owns multiple children. Perfect for Customers having many Orders.</p>
|
|
45
|
+
<div class="p-4 bg-slate-50 rounded-xl font-mono text-xs text-purple-700 font-bold border border-slate-100">relationship 1:m Customer to Order</div>
|
|
46
|
+
</div>
|
|
47
|
+
<div class="p-8 bg-white border border-slate-200 rounded-[2rem] shadow-sm hover:border-purple-200 transition-all group">
|
|
48
|
+
<div class="w-12 h-12 bg-purple-100 rounded-xl flex items-center justify-center mb-6 text-2xl group-hover:scale-110 transition-transform">🔗</div>
|
|
49
|
+
<h3 class="text-xl font-bold text-slate-900 mb-4 m-0 font-mono">m:1 (Many-to-One)</h3>
|
|
50
|
+
<p class="text-sm text-slate-600 leading-relaxed mb-6 italic">Multiple entities reference a single shared resource. Multiple Car entities belonging to a single Manufacturer.</p>
|
|
51
|
+
<div class="p-4 bg-slate-50 rounded-xl font-mono text-xs text-purple-700 font-bold border border-slate-100">relationship m:1 Car to Manufacturer</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</section>
|
|
55
|
+
|
|
56
|
+
<!-- Integrity Modifiers -->
|
|
57
|
+
<section class="mb-20">
|
|
58
|
+
<h2 class="text-3xl font-black text-slate-900 mb-8 tracking-tight italic underline decoration-purple-500 underline-offset-8">Referential Integrity Modifiers</h2>
|
|
59
|
+
<div class="p-8 bg-purple-50 rounded-3xl border border-purple-100">
|
|
60
|
+
<div class="flex items-start space-x-6">
|
|
61
|
+
<div class="w-12 h-12 bg-white rounded-2xl flex items-center justify-center text-xl shadow-sm flex-shrink-0">⚓</div>
|
|
62
|
+
<div>
|
|
63
|
+
<h4 class="text-lg font-bold text-purple-900 mb-2 m-0 font-mono">required</h4>
|
|
64
|
+
<p class="text-sm text-purple-800 leading-relaxed m-0 italic mb-4">By adding the `required` keyword to any relationship, GO-DUCK enforces strict existence checking at the database and API level.</p>
|
|
65
|
+
<code class="px-3 py-1 bg-white text-purple-700 rounded-lg text-xs font-bold border border-purple-200">relationship 1:m Customer to Order required</code>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</section>
|
|
70
|
+
|
|
71
|
+
<div class="flex flex-col md:flex-row gap-4 mb-20">
|
|
72
|
+
<a href="gdl-annotations.html" class="flex-1 p-6 bg-slate-900 rounded-2xl text-white hover:bg-slate-800 transition-colors group">
|
|
73
|
+
<div class="text-xs font-bold text-slate-500 uppercase tracking-widest mb-2">Next Category</div>
|
|
74
|
+
<div class="text-xl font-bold flex items-center">
|
|
75
|
+
🎯 Power-up Annotations
|
|
76
|
+
<svg class="w-5 h-5 ml-2 group-hover:translate-x-1 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7l5 5m0 0l-5 5m5-5H6" /></svg>
|
|
77
|
+
</div>
|
|
78
|
+
</a>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
@@ -1,223 +1,79 @@
|
|
|
1
|
-
<div class="
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
</
|
|
8
|
-
|
|
9
|
-
<section class="mb-12">
|
|
10
|
-
<h2 class="text-2xl font-bold text-slate-800 mb-6 flex items-center">
|
|
11
|
-
<span class="w-8 h-8 rounded-lg bg-emerald-100 text-emerald-600 flex items-center justify-center mr-3 text-sm">
|
|
12
|
-
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"></path></svg>
|
|
13
|
-
</span>
|
|
14
|
-
GDL Syntax & Structure
|
|
15
|
-
</h2>
|
|
16
|
-
<p class="mb-6 text-slate-600 leading-relaxed">GDL allows you to define your core business entities and the relationships between them. It looks and acts slightly similarly to JHipster's JDL.</p>
|
|
17
|
-
|
|
18
|
-
<div class="bg-[#1e1e1e] rounded-xl overflow-hidden shadow-lg mb-4">
|
|
19
|
-
<div class="bg-[#2d2d2d] px-4 py-2 border-b border-[#404040] flex items-center justify-between">
|
|
20
|
-
<div class="flex items-center">
|
|
21
|
-
<div class="flex space-x-1.5 mr-4">
|
|
22
|
-
<div class="w-3 h-3 rounded-full bg-rose-500"></div>
|
|
23
|
-
<div class="w-3 h-3 rounded-full bg-amber-500"></div>
|
|
24
|
-
<div class="w-3 h-3 rounded-full bg-emerald-500"></div>
|
|
25
|
-
</div>
|
|
26
|
-
<span class="text-xs text-slate-300 font-mono">schema.gdl</span>
|
|
27
|
-
</div>
|
|
1
|
+
<div class="prose prose-slate max-w-none">
|
|
2
|
+
<!-- Marketing Hero -->
|
|
3
|
+
<div class="flex items-center space-x-3 mb-10 text-indigo-700">
|
|
4
|
+
<div class="p-4 bg-gradient-to-br from-indigo-600 to-indigo-800 rounded-3xl shadow-xl shadow-indigo-100">
|
|
5
|
+
<svg class="w-10 h-10 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
6
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" />
|
|
7
|
+
</svg>
|
|
28
8
|
</div>
|
|
29
|
-
<div
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
title String required unique
|
|
33
|
-
content Text required
|
|
34
|
-
status ArticleStatus required
|
|
35
|
-
publishedDate LocalDate
|
|
36
|
-
views Integer
|
|
37
|
-
metadata JSONB
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
enum ArticleStatus {
|
|
41
|
-
DRAFT, PUBLISHED, ARCHIVED
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
entity Author {
|
|
45
|
-
name String required
|
|
46
|
-
biography Text
|
|
47
|
-
settings JSON
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
relationship OneToMany {
|
|
51
|
-
Author{article} to Article{author} required
|
|
52
|
-
}</code></pre>
|
|
9
|
+
<div>
|
|
10
|
+
<h1 class="text-4xl font-black text-slate-900 m-0 tracking-tight leading-none">Introduction to GDL</h1>
|
|
11
|
+
<p class="text-indigo-600 font-bold tracking-widest uppercase text-[10px] mt-2 ml-1">Go Duck Language Specification</p>
|
|
53
12
|
</div>
|
|
54
13
|
</div>
|
|
55
|
-
</section>
|
|
56
14
|
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
</span>
|
|
62
|
-
Supported Data Types
|
|
63
|
-
</h2>
|
|
64
|
-
<div class="overflow-x-auto rounded-xl border border-slate-200">
|
|
65
|
-
<table class="min-w-full text-left bg-white">
|
|
66
|
-
<thead>
|
|
67
|
-
<tr class="bg-slate-50 border-b border-slate-200 text-slate-500 uppercase text-xs tracking-wider">
|
|
68
|
-
<th class="p-4 font-semibold">GDL Type</th>
|
|
69
|
-
<th class="p-4 font-semibold">Go Struct Type</th>
|
|
70
|
-
<th class="p-4 font-semibold">Postgres / SQL Type</th>
|
|
71
|
-
<th class="p-4 font-semibold">GraphQL / Proto</th>
|
|
72
|
-
</tr>
|
|
73
|
-
</thead>
|
|
74
|
-
<tbody class="text-sm text-slate-700 divide-y divide-slate-100">
|
|
75
|
-
<tr class="hover:bg-slate-50 transition-colors"><td class="p-4 font-semibold font-mono text-indigo-600">String</td><td class="p-4"><code class="bg-slate-100 px-1 py-0.5 rounded text-xs text-slate-800">string</code></td><td class="p-4">VARCHAR(255)</td><td class="p-4">String / string</td></tr>
|
|
76
|
-
<tr class="hover:bg-slate-50 transition-colors"><td class="p-4 font-semibold font-mono text-indigo-600">String(N)</td><td class="p-4"><code class="bg-slate-100 px-1 py-0.5 rounded text-xs text-slate-800">string</code></td><td class="p-4">VARCHAR(N)</td><td class="p-4">String / string</td></tr>
|
|
77
|
-
<tr class="hover:bg-slate-50 transition-colors"><td class="p-4 font-semibold font-mono text-indigo-600">Text</td><td class="p-4"><code class="bg-slate-100 px-1 py-0.5 rounded text-xs text-slate-800">string</code></td><td class="p-4">TEXT</td><td class="p-4">String / string</td></tr>
|
|
78
|
-
<tr class="hover:bg-slate-50 transition-colors"><td class="p-4 font-semibold font-mono text-indigo-600">JSON</td><td class="p-4"><code class="bg-slate-100 px-1 py-0.5 rounded text-xs text-slate-800">datatypes.JSON</code></td><td class="p-4 text-emerald-600 font-semibold">JSON</td><td class="p-4">String / string</td></tr>
|
|
79
|
-
<tr class="hover:bg-slate-50 transition-colors"><td class="p-4 font-semibold font-mono text-indigo-600">JSONB</td><td class="p-4"><code class="bg-slate-100 px-1 py-0.5 rounded text-xs text-slate-800">datatypes.JSON</code></td><td class="p-4 text-emerald-600 font-semibold">JSONB</td><td class="p-4">String / string</td></tr>
|
|
80
|
-
<tr class="hover:bg-slate-50 transition-colors"><td class="p-4 font-semibold font-mono text-indigo-600">Integer</td><td class="p-4"><code class="bg-slate-100 px-1 py-0.5 rounded text-xs text-slate-800">int</code></td><td class="p-4">INT</td><td class="p-4">Int / int32</td></tr>
|
|
81
|
-
<tr class="hover:bg-slate-50 transition-colors"><td class="p-4 font-semibold font-mono text-indigo-600">Long</td><td class="p-4"><code class="bg-slate-100 px-1 py-0.5 rounded text-xs text-slate-800">int64</code></td><td class="p-4">BIGINT</td><td class="p-4">ID / int64</td></tr>
|
|
82
|
-
<tr class="hover:bg-slate-50 transition-colors"><td class="p-4 font-semibold font-mono text-indigo-600">Float</td><td class="p-4"><code class="bg-slate-100 px-1 py-0.5 rounded text-xs text-slate-800">float64</code></td><td class="p-4">DECIMAL</td><td class="p-4">Float / float32</td></tr>
|
|
83
|
-
<tr class="hover:bg-slate-50 transition-colors"><td class="p-4 font-semibold font-mono text-indigo-600">BigDecimal</td><td class="p-4"><code class="bg-slate-100 px-1 py-0.5 rounded text-xs text-slate-800">float64</code></td><td class="p-4">DECIMAL</td><td class="p-4">Float / double</td></tr>
|
|
84
|
-
<tr class="hover:bg-slate-50 transition-colors"><td class="p-4 font-semibold font-mono text-indigo-600">Boolean</td><td class="p-4"><code class="bg-slate-100 px-1 py-0.5 rounded text-xs text-slate-800">bool</code></td><td class="p-4">BOOLEAN</td><td class="p-4">Boolean / bool</td></tr>
|
|
85
|
-
<tr class="hover:bg-slate-50 transition-colors"><td class="p-4 font-semibold font-mono text-indigo-600">LocalDate</td><td class="p-4"><code class="bg-slate-100 px-1 py-0.5 rounded text-xs text-slate-800">time.Time</code></td><td class="p-4">DATE</td><td class="p-4">String / string</td></tr>
|
|
86
|
-
<tr class="hover:bg-slate-50 transition-colors"><td class="p-4 font-semibold font-mono text-indigo-600">Instant</td><td class="p-4"><code class="bg-slate-100 px-1 py-0.5 rounded text-xs text-slate-800">time.Time</code></td><td class="p-4">TIMESTAMP</td><td class="p-4">String / string</td></tr>
|
|
87
|
-
<tr class="hover:bg-slate-50 transition-colors"><td class="p-4 font-semibold font-mono text-indigo-600">Enum</td><td class="p-4"><code class="bg-slate-100 px-1 py-0.5 rounded text-xs text-slate-800">CustomType</code></td><td class="p-4">VARCHAR(50)</td><td class="p-4">String / string</td></tr>
|
|
88
|
-
</tbody>
|
|
89
|
-
</table>
|
|
15
|
+
<div class="bg-indigo-50 border-l-4 border-indigo-500 p-8 rounded-r-3xl mb-12">
|
|
16
|
+
<p class="text-lg text-indigo-900 font-medium leading-relaxed m-0">
|
|
17
|
+
<strong>GDL (Go Duck Language)</strong> is the evolutionary blueprint of your ecosystem. It is a stateful, high-fidelity modeling language designed to describe entities, relationships, and infrastructure power-ups in a human-readable format.
|
|
18
|
+
</p>
|
|
90
19
|
</div>
|
|
91
|
-
</section>
|
|
92
20
|
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
<p class="mb-6 text-slate-600 leading-relaxed">GDL supports custom Enum types for fields that have a predefined set of allowed values. Enums are generated as Go types with constants and mapped to safe string columns in the database.</p>
|
|
101
|
-
|
|
102
|
-
<div class="bg-[#1e1e1e] rounded-xl overflow-hidden shadow-lg">
|
|
103
|
-
<div class="p-5 overflow-x-auto text-sm text-slate-300">
|
|
104
|
-
<pre><code class="language-plaintext">enum Language {
|
|
105
|
-
ENGLISH, FRENCH, GERMAN
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
entity Person {
|
|
109
|
-
name String required
|
|
110
|
-
nativeLanguage Language
|
|
111
|
-
}</code></pre>
|
|
21
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-16">
|
|
22
|
+
<div class="group p-8 bg-white border border-slate-200 rounded-3xl shadow-sm hover:shadow-md transition-all">
|
|
23
|
+
<h3 class="text-xl font-bold text-slate-900 mb-4 flex items-center">
|
|
24
|
+
<span class="w-8 h-8 rounded-lg bg-slate-100 flex items-center justify-center mr-3 text-sm">🌱</span>
|
|
25
|
+
One Truth
|
|
26
|
+
</h3>
|
|
27
|
+
<p class="text-slate-600 text-sm leading-relaxed mb-0">Unlike standard generators, GDL is the single source of truth for your Database schema, Protobuf definitions, GraphQL types, and Go Repository logic.</p>
|
|
112
28
|
</div>
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z"></path></svg>
|
|
120
|
-
</span>
|
|
121
|
-
Modifiers & Annotations
|
|
122
|
-
</h2>
|
|
123
|
-
<div class="grid grid-cols-1 md:grid-cols-2 gap-5 mb-8">
|
|
124
|
-
<div class="p-5 rounded-2xl border border-slate-200 bg-white">
|
|
125
|
-
<h3 class="font-bold text-slate-900 mb-2 font-mono text-indigo-600">required</h3>
|
|
126
|
-
<p class="text-sm text-slate-600 leading-relaxed">Forces the field to be NOT NULL in the database, missing fields are blocked by the Gin validator natively.</p>
|
|
127
|
-
</div>
|
|
128
|
-
<div class="p-5 rounded-2xl border border-slate-200 bg-white">
|
|
129
|
-
<h3 class="font-bold text-slate-900 mb-2 font-mono text-indigo-600">unique</h3>
|
|
130
|
-
<p class="text-sm text-slate-600 leading-relaxed">Adds a standard UNIQUE constraint indexing configuration at the database level.</p>
|
|
131
|
-
</div>
|
|
132
|
-
</div>
|
|
133
|
-
<div class="p-6 rounded-2xl border border-rose-200 bg-rose-50/50">
|
|
134
|
-
<h3 class="font-bold text-rose-900 mb-2 font-mono drop-shadow-sm">@Audited</h3>
|
|
135
|
-
<p class="text-sm text-rose-800 leading-relaxed">An entity annotation that completely re-wires the structural behavior of the model. Standard <code class="bg-rose-100 px-1 py-0.5 rounded text-rose-900">created_at</code> triggers are bypassed and 5 highly-detailed audit columns are injected: <code>created_by, created_date, last_modified_by, last_modified_date, last_modified_user_id</code>. All changes are captured implicitly by the JWT middleware.</p>
|
|
136
|
-
</div>
|
|
137
|
-
</section>
|
|
138
|
-
|
|
139
|
-
<section class="mb-10">
|
|
140
|
-
<h2 class="text-2xl font-bold text-slate-800 mb-6 flex items-center">
|
|
141
|
-
<span class="w-8 h-8 rounded-lg bg-orange-100 text-orange-600 flex items-center justify-center mr-3 text-sm">
|
|
142
|
-
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"></path></svg>
|
|
143
|
-
</span>
|
|
144
|
-
Incremental Migration Engine
|
|
145
|
-
</h2>
|
|
146
|
-
<p class="mb-4 text-slate-600 leading-relaxed">Running <code class="bg-slate-100 px-1 py-0.5 rounded text-slate-800 font-mono text-sm">go-duck import-gdl app.gdl</code> compares your GDL file against the physical <code>.go-duck/</code> snapshot state securely stored in the repo.</p>
|
|
147
|
-
<p class="mb-6 text-slate-600 leading-relaxed">It detects exactly what changed (such as removing a field, changing field types, adding new nested JSON) and generates precise atomic standard Liquibase XML <code>migrations/liquibase/changelogs/</code> scripts to evolve the live database safely without destroying data.</p>
|
|
148
|
-
|
|
149
|
-
<div class="bg-blue-50/80 border border-blue-200 p-5 rounded-xl flex items-start shadow-sm">
|
|
150
|
-
<svg class="w-6 h-6 text-blue-500 mt-0.5 mr-3 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
|
|
151
|
-
<div>
|
|
152
|
-
<h4 class="font-semibold text-blue-900 mb-1">Golden Rule</h4>
|
|
153
|
-
<p class="text-blue-800 text-sm leading-relaxed mb-2">Avoid editing Liquibase XML manually unless correcting an anomaly. Let the GDL manage your migrations.</p>
|
|
29
|
+
<div class="group p-8 bg-white border border-slate-200 rounded-3xl shadow-sm hover:shadow-md transition-all">
|
|
30
|
+
<h3 class="text-xl font-bold text-slate-900 mb-4 flex items-center">
|
|
31
|
+
<span class="w-8 h-8 rounded-lg bg-slate-100 flex items-center justify-center mr-3 text-sm">🔄</span>
|
|
32
|
+
Stateful Evolution
|
|
33
|
+
</h3>
|
|
34
|
+
<p class="text-slate-600 text-sm leading-relaxed mb-0">The GDL engine tracks schema deltas. Adding a field in GDL automatically generates the corresponding <strong>Goose SQL Migration</strong> without wiping your data.</p>
|
|
154
35
|
</div>
|
|
155
36
|
</div>
|
|
156
|
-
</section>
|
|
157
37
|
|
|
158
|
-
<
|
|
159
|
-
<
|
|
160
|
-
<span class="w-8 h-8 rounded-lg bg-indigo-100 text-indigo-600 flex items-center justify-center mr-3 text-sm">
|
|
161
|
-
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"></path></svg>
|
|
162
|
-
</span>
|
|
163
|
-
Managing Relationships
|
|
164
|
-
</h2>
|
|
165
|
-
<p class="mb-6 text-slate-600 leading-relaxed">Relationships in GDL define how entities connect at the database level (foreign keys) and how they are represented in Go structs and GraphQL schemas. Just like JHipster, we support four primary types.</p>
|
|
38
|
+
<h2 class="text-3xl font-black text-slate-900 mb-8 tracking-tight">The Basic Anatomy</h2>
|
|
39
|
+
<p class="text-slate-600 mb-8">A GDL file is composed of three primary building blocks: <strong>Entities</strong>, <strong>Enums</strong>, and <strong>Relationships</strong>.</p>
|
|
166
40
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
<
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
<p class="text-slate-600 mb-4 text-sm bg-slate-50 p-3 border-l-4 border-blue-400 rounded-r-lg">Example: An <code class="font-bold">Author</code> has many <code class="font-bold">Articles</code>.</p>
|
|
174
|
-
<div class="bg-[#1e1e1e] rounded-xl overflow-hidden shadow-lg">
|
|
175
|
-
<div class="p-4 overflow-x-auto text-sm">
|
|
176
|
-
<pre><code class="language-plaintext">relationship OneToMany {
|
|
177
|
-
Author{article} to Article{author}
|
|
178
|
-
}</code></pre>
|
|
41
|
+
<div class="bg-slate-900 rounded-[2.5rem] p-10 text-white shadow-2xl relative overflow-hidden group mb-16">
|
|
42
|
+
<div class="absolute inset-0 bg-gradient-to-br from-indigo-900/40 to-transparent"></div>
|
|
43
|
+
<div class="relative z-10">
|
|
44
|
+
<div class="flex items-center justify-between mb-6">
|
|
45
|
+
<span class="px-4 py-1 bg-indigo-500/20 rounded-full text-indigo-300 text-xs font-bold border border-indigo-500/30">schema.gdl</span>
|
|
46
|
+
<span class="text-slate-500 text-xs font-mono select-none">DUCK-ENGINE-V3</span>
|
|
179
47
|
</div>
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
48
|
+
<pre class="text-indigo-400 font-mono text-base leading-relaxed overflow-x-auto selection:bg-indigo-500/30">
|
|
49
|
+
<span class="text-slate-500">// Define an elite entity with power-ups</span>
|
|
50
|
+
@Audited @Federated
|
|
51
|
+
entity Customer {
|
|
52
|
+
string(100) fullName required
|
|
53
|
+
string(255) email unique
|
|
54
|
+
datetime lastLogin
|
|
55
|
+
}
|
|
183
56
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
<p class="text-slate-600 mb-4 text-sm bg-slate-50 p-3 border-l-4 border-slate-300 rounded-r-lg">Essentially the inverse of One-to-Many, used to specify the owner side explicitly.</p>
|
|
188
|
-
<div class="bg-[#1e1e1e] rounded-xl overflow-hidden shadow-lg">
|
|
189
|
-
<div class="p-4 overflow-x-auto text-sm">
|
|
190
|
-
<pre><code class="language-plaintext">relationship ManyToOne {
|
|
191
|
-
Article{author} to Author
|
|
192
|
-
}</code></pre>
|
|
193
|
-
</div>
|
|
57
|
+
<span class="text-slate-500">// Define a directional relationship</span>
|
|
58
|
+
relationship Customer 1:m Order
|
|
59
|
+
</pre>
|
|
194
60
|
</div>
|
|
195
61
|
</div>
|
|
196
62
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
<pre><code class="language-plaintext">relationship OneToOne {
|
|
204
|
-
User{profile} to Profile{user}
|
|
205
|
-
}</code></pre>
|
|
63
|
+
<div class="flex flex-col md:flex-row gap-4 mb-20">
|
|
64
|
+
<a href="gdl-entities.html" class="flex-1 p-6 bg-slate-900 rounded-2xl text-white hover:bg-slate-800 transition-colors group">
|
|
65
|
+
<div class="text-xs font-bold text-slate-500 uppercase tracking-widest mb-2">Next Category</div>
|
|
66
|
+
<div class="text-xl font-bold flex items-center">
|
|
67
|
+
Entities & Fields
|
|
68
|
+
<svg class="w-5 h-5 ml-2 group-hover:translate-x-1 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7l5 5m0 0l-5 5m5-5H6" /></svg>
|
|
206
69
|
</div>
|
|
207
|
-
</
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
<p class="text-slate-600 mb-4 text-sm bg-slate-50 p-3 border-l-4 border-purple-400 rounded-r-lg">Example: <code class="font-bold">Students</code> enrolled in many <code class="font-bold">Courses</code>.</p>
|
|
214
|
-
<div class="bg-[#1e1e1e] rounded-xl overflow-hidden shadow-lg">
|
|
215
|
-
<div class="p-4 overflow-x-auto text-sm">
|
|
216
|
-
<pre><code class="language-plaintext">relationship ManyToMany {
|
|
217
|
-
Student{course} to Course{student}
|
|
218
|
-
}</code></pre>
|
|
70
|
+
</a>
|
|
71
|
+
<a href="cli.html" class="flex-1 p-6 bg-white border border-slate-200 rounded-2xl text-slate-900 hover:bg-slate-50 transition-colors group">
|
|
72
|
+
<div class="text-xs font-bold text-slate-400 uppercase tracking-widest mb-2">Reference</div>
|
|
73
|
+
<div class="text-xl font-bold flex items-center">
|
|
74
|
+
CLI Usage
|
|
75
|
+
<svg class="w-5 h-5 ml-2 group-hover:translate-x-1 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7l5 5m0 0l-5 5m5-5H6" /></svg>
|
|
219
76
|
</div>
|
|
220
|
-
</
|
|
221
|
-
<p class="mt-4 text-sm text-slate-500 italic">This triggers the automatic generation of a join table (e.g., <code>student_course</code>) in Liquibase.</p>
|
|
77
|
+
</a>
|
|
222
78
|
</div>
|
|
223
|
-
</
|
|
79
|
+
</div>
|
|
@@ -1,51 +1,65 @@
|
|
|
1
|
-
<
|
|
2
|
-
<
|
|
1
|
+
<div class="prose prose-slate max-w-none">
|
|
2
|
+
<div class="flex items-center space-x-3 mb-8 text-rose-700">
|
|
3
|
+
<div class="p-4 bg-gradient-to-br from-rose-600 to-rose-800 rounded-2xl shadow-lg shadow-rose-100">
|
|
4
|
+
<svg class="w-8 h-8 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
5
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 4a2 2 0 114 0v1a1 1 0 001 1h3a1 1 0 011 1v3a1 1 0 01-1 1h-1a2 2 0 100 4h1a1 1 0 011 1v3a1 1 0 01-1 1h-3a1 1 0 00-1 1v1a2 2 0 11-4 0v-1a1 1 0 00-1-1H7a1 1 0 01-1-1v-3a1 1 0 011-1h1a2 2 0 100-4H7a1 1 0 01-1-1V7a1 1 0 011-1h3a1 1 0 001-1V4z" />
|
|
6
|
+
</svg>
|
|
7
|
+
</div>
|
|
8
|
+
<h1 class="text-5xl font-black text-slate-900 m-0 tracking-tighter leading-none">Graph Discovery <br><span class="text-rose-600 italic leading-snug">The Entitlements Schema.</span></h1>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<p class="text-2xl text-slate-500 font-medium mb-12 leading-relaxed tracking-tight group hover:text-slate-600 font-serif italic transition-all duration-300">
|
|
12
|
+
Experience total query flexibility. GO-DUCK generates a unified, high-performance GraphQL schema that respects your multi-tenant isolation and OIDC entitlements out of the box.
|
|
13
|
+
</p>
|
|
3
14
|
|
|
4
|
-
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
<!-- The Graph Core Advantage -->
|
|
16
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-20 px-4">
|
|
17
|
+
<div class="p-10 bg-rose-50 rounded-[3rem] border border-rose-100 shadow-sm border-l-[1.5rem] border-l-rose-500">
|
|
18
|
+
<h5 class="font-black text-rose-900 mb-2 uppercase text-xs tracking-widest italic tracking-wide underline decoration-rose-300">Entitlements-Safe</h5>
|
|
19
|
+
<p class="text-sm text-rose-800 leading-relaxed font-medium italic underline decoration-rose-200">Our resolvers are natively integrated with the <strong>Federated Permission Engine</strong>, automatically filtering objects based on the user's active Realm Role.</p>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="p-10 bg-slate-900 rounded-[3rem] border border-slate-800 shadow-xl border-b-[1.5rem] border-b-rose-700">
|
|
22
|
+
<h5 class="font-black text-rose-400 mb-2 uppercase text-xs tracking-widest italic tracking-wide">Complex Relations</h5>
|
|
23
|
+
<p class="text-indigo-100/70 leading-relaxed font-medium italic">Traverse the entire graph with deep parent-child relationships, all resolved efficiently through our <strong>Eager Loading</strong> repository layer.</p>
|
|
24
|
+
</div>
|
|
10
25
|
</div>
|
|
11
26
|
|
|
12
|
-
|
|
27
|
+
<!-- The Query Masterclass Section -->
|
|
28
|
+
<section class="mb-20">
|
|
29
|
+
<h2 class="text-3xl font-black text-slate-900 mb-10 tracking-tight italic text-center uppercase tracking-[0.1em]">The Graph Masterclass</h2>
|
|
30
|
+
|
|
31
|
+
<div class="bg-slate-950 rounded-[3rem] p-12 text-white shadow-2xl relative overflow-hidden flex flex-col items-center group transition-all duration-300 hover:scale-[1.01]">
|
|
32
|
+
<div class="w-full text-left bg-slate-900/50 rounded-3xl p-8 border border-white/5 backdrop-blur-sm shadow-lg shadow-black/20">
|
|
33
|
+
<pre class="text-rose-300 font-mono text-sm leading-8 whitespace-pre italic">
|
|
34
|
+
<span class="text-slate-500">// Fetching Federated {{capitalize (defaultStr (lookup entities "0.name") "Entity")}} with Service History</span>
|
|
13
35
|
query {
|
|
14
|
-
|
|
36
|
+
{{toLowerCase (defaultStr (lookup entities "0.name") "entity")}}s {
|
|
15
37
|
id
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
{{/if}}
|
|
21
|
-
}
|
|
22
|
-
}</code></pre>
|
|
23
|
-
</section>
|
|
24
|
-
|
|
25
|
-
<section class="mb-10">
|
|
26
|
-
<h2 class="text-2xl font-bold text-gray-800 mb-4 border-b pb-2">Working with Frontend Libraries</h2>
|
|
27
|
-
<p class="mb-4">Here is how to seamlessly execute your generated queries inside modern JavaScript frameworks using <code>fetch</code>.</p>
|
|
28
|
-
|
|
29
|
-
<pre><code class="language-javascript">const fetchEntity = async () => {
|
|
30
|
-
const query = \`
|
|
31
|
-
query {
|
|
32
|
-
list{{capitalize (defaultStr (lookup entities "0.name") "Entity")}}s(page: 1, size: 5) {
|
|
33
|
-
id
|
|
34
|
-
{{#if entities.length}}{{#if entities.[0].fields.length}}{{entities.[0].fields.[0].name}}{{/if}}{{/if}}
|
|
35
|
-
}
|
|
38
|
+
make
|
|
39
|
+
history {
|
|
40
|
+
date
|
|
41
|
+
notes
|
|
36
42
|
}
|
|
37
|
-
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
</pre>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</section>
|
|
38
49
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
</
|
|
50
|
+
<!-- Federated Resolver Hook -->
|
|
51
|
+
<section class="mb-20">
|
|
52
|
+
<div class="bg-gradient-to-tr from-rose-950 via-rose-900 to-slate-950 border border-rose-800/50 rounded-[3rem] p-16 text-white text-center shadow-2xl relative overflow-hidden group">
|
|
53
|
+
<h2 class="text-4xl font-black mb-6 tracking-tight italic underline decoration-rose-500 underline-offset-8">Universal Graph Coverage</h2>
|
|
54
|
+
<p class="text-rose-100 text-lg mb-10 max-w-2xl mx-auto leading-relaxed italic font-medium">
|
|
55
|
+
Every entity, enum, and relationship you define in GDL is automatically exported to the GraphQL engine. <strong>Query what you need, exactly how you need it.</strong>
|
|
56
|
+
</p>
|
|
57
|
+
<div class="flex flex-col md:flex-row gap-6 justify-center">
|
|
58
|
+
<div class="px-8 py-4 bg-white/10 rounded-3xl border border-white/10 flex flex-col items-center hover:bg-white/20 transition-all duration-300 cursor-default shadow-md group-hover:scale-110">
|
|
59
|
+
<span class="text-rose-400 font-black text-2xl uppercase italic font-mono font-serif mt-2 italic tracking-tighter">Automatic Resolvers</span>
|
|
60
|
+
<span class="text-[0.6rem] text-white/50 tracking-[0.3em] font-bold uppercase mt-2">Zero Boilerplate</span>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</section>
|
|
65
|
+
</div>
|