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,241 @@
|
|
|
1
|
+
<div class="prose prose-slate max-w-none">
|
|
2
|
+
<!-- Hero Section -->
|
|
3
|
+
<div class="flex items-center space-x-3 mb-8 text-blue-700">
|
|
4
|
+
<div class="p-4 bg-gradient-to-br from-blue-600 to-indigo-800 rounded-2xl shadow-lg shadow-blue-200">
|
|
5
|
+
<svg class="w-8 h-8 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
6
|
+
<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" />
|
|
7
|
+
</svg>
|
|
8
|
+
</div>
|
|
9
|
+
<h1 class="text-5xl font-black text-slate-900 m-0 tracking-tight leading-tight">Federated <br><span class="text-blue-600 italic">Multi-Silo Masterclass.</span></h1>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<p class="text-2xl text-slate-500 font-medium mb-12 leading-relaxed">
|
|
13
|
+
Achieve 100% data isolation with a unified global view. GO-DUCK's Federated Architecture orchestrates multiple independent database silos into a single, high-performance empire.
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<!-- FOUNDATIONAL CONCEPTS -->
|
|
17
|
+
<section class="mb-20">
|
|
18
|
+
<h2 class="text-3xl font-black text-slate-900 mb-8 tracking-tight italic underline decoration-blue-500 underline-offset-8">The Foundations: Silos vs. Federation</h2>
|
|
19
|
+
|
|
20
|
+
<div class="grid grid-cols-1 lg:grid-cols-2 gap-10">
|
|
21
|
+
<div class="p-8 bg-white border border-slate-200 rounded-[2.5rem] shadow-sm relative overflow-hidden group hover:border-blue-300 transition-all">
|
|
22
|
+
<div class="absolute top-0 right-0 w-24 h-24 bg-blue-50 translate-x-12 -translate-y-12 rounded-full group-hover:scale-150 transition-transform"></div>
|
|
23
|
+
<h3 class="text-xl font-bold text-slate-900 mb-4 flex items-center">
|
|
24
|
+
<span class="w-8 h-8 bg-blue-100 text-blue-600 rounded-lg flex items-center justify-center mr-3 font-black">S</span>
|
|
25
|
+
What is a "Silo"?
|
|
26
|
+
</h3>
|
|
27
|
+
<p class="text-slate-600 text-sm leading-relaxed mb-4">
|
|
28
|
+
In database architecture, a <strong>Silo</strong> is a physically isolated storage unit. Unlike traditional multi-tenancy where all users share the same table (Soft-Tenancy), GO-DUCK uses <strong>Hard-Silo Isolation</strong>.
|
|
29
|
+
</p>
|
|
30
|
+
<ul class="space-y-2 text-xs text-slate-500 font-medium">
|
|
31
|
+
<li class="flex items-center"><svg class="w-3.5 h-3.5 mr-2 text-blue-500" fill="currentColor" viewBox="0 0 20 20"><path d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"></path></svg> <strong>Physical Separation</strong>: Each Silo is its own Database/Schema.</li>
|
|
32
|
+
<li class="flex items-center"><svg class="w-3.5 h-3.5 mr-2 text-blue-500" fill="currentColor" viewBox="0 0 20 20"><path d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"></path></svg> <strong>Security</strong>: No risk of cross-tenant data leakage via <code>WHERE</code> clause bugs.</li>
|
|
33
|
+
<li class="flex items-center"><svg class="w-3.5 h-3.5 mr-2 text-blue-500" fill="currentColor" viewBox="0 0 20 20"><path d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"></path></svg> <strong>Compliance</strong>: GDPR/HIPAA-ready dedicated storage paths.</li>
|
|
34
|
+
</ul>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<div class="p-8 bg-slate-900 border border-slate-800 rounded-[2.5rem] shadow-xl relative overflow-hidden group">
|
|
38
|
+
<div class="absolute top-0 right-0 w-24 h-24 bg-blue-500/10 translate-x-12 -translate-y-12 rounded-full group-hover:scale-150 transition-transform"></div>
|
|
39
|
+
<h3 class="text-xl font-bold text-white mb-4 flex items-center">
|
|
40
|
+
<span class="w-8 h-8 bg-blue-600 text-white rounded-lg flex items-center justify-center mr-3 font-black">F</span>
|
|
41
|
+
What is "Federation"?
|
|
42
|
+
</h3>
|
|
43
|
+
<p class="text-slate-400 text-sm leading-relaxed mb-4">
|
|
44
|
+
<strong>Federation</strong> is the "Virtual Connectivity Layer" that sits above your Silos. It allows your application to treat 100 independent databases as a single <strong>Unified Empire</strong>.
|
|
45
|
+
</p>
|
|
46
|
+
<ul class="space-y-2 text-xs text-slate-500 font-medium italic">
|
|
47
|
+
<li class="flex items-center"><svg class="w-3.5 h-3.5 mr-2 text-blue-400" fill="currentColor" viewBox="0 0 20 20"><path d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"></path></svg> <strong>Aggregation</strong>: Query one endpoint, get results from every Silo.</li>
|
|
48
|
+
<li class="flex items-center"><svg class="w-3.5 h-3.5 mr-2 text-blue-400" fill="currentColor" viewBox="0 0 20 20"><path d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"></path></svg> <strong>Orchestration</strong>: Broadcat a single write to multiple regions.</li>
|
|
49
|
+
<li class="flex items-center"><svg class="w-3.5 h-3.5 mr-2 text-blue-400" fill="currentColor" viewBox="0 0 20 20"><path d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"></path></svg> <strong>Transparency</strong>: Front-end devs don't need to know which Silo they are hitting.</li>
|
|
50
|
+
</ul>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</section>
|
|
54
|
+
|
|
55
|
+
<!-- The Scenario: The Dealership Empire -->
|
|
56
|
+
<section class="mb-20">
|
|
57
|
+
<div class="bg-blue-50 border border-blue-100 rounded-[3rem] p-12 relative overflow-hidden">
|
|
58
|
+
<h2 class="text-3xl font-black text-slate-900 mb-6 italic tracking-tight uppercase">Case Study: The Dealership Empire</h2>
|
|
59
|
+
<p class="text-slate-600 mb-8 leading-relaxed max-w-3xl">
|
|
60
|
+
Imagine you are running a global car dealership. Every regional branch (USA, Germany, Japan) requires <strong>physical isolation</strong> for local accounting compliance, but your CEO needs a <strong>global stock report</strong> in real-time.
|
|
61
|
+
</p>
|
|
62
|
+
|
|
63
|
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
|
64
|
+
<div class="p-6 bg-white rounded-2xl border border-blue-100 shadow-sm border-t-4 border-t-blue-500">
|
|
65
|
+
<h4 class="font-bold text-slate-800 mb-2 font-mono">USA SILO</h4>
|
|
66
|
+
<p class="text-xs text-slate-500 leading-relaxed italic">"Site-specific Inventory. Physically trapped in local DB."</p>
|
|
67
|
+
</div>
|
|
68
|
+
<div class="p-6 bg-white rounded-2xl border border-blue-100 shadow-sm border-t-4 border-t-blue-500">
|
|
69
|
+
<h4 class="font-bold text-slate-800 mb-2 font-mono">UK SILO</h4>
|
|
70
|
+
<p class="text-xs text-slate-500 leading-relaxed italic">"Isolated branch ops. No link to foreign data."</p>
|
|
71
|
+
</div>
|
|
72
|
+
<div class="p-6 bg-indigo-600 rounded-2xl shadow-xl text-white">
|
|
73
|
+
<h4 class="font-bold mb-2 font-mono uppercase tracking-widest text-indigo-200">FEDERAL LAYER</h4>
|
|
74
|
+
<p class="text-xs text-indigo-100 leading-relaxed font-bold italic">"The Harvester. Aggregates USA + UK into a single API response."</p>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</section>
|
|
79
|
+
|
|
80
|
+
<!-- TRIPLE-IDENTITY REGISTRY DIAGRAM -->
|
|
81
|
+
<section class="mb-20">
|
|
82
|
+
<h2 class="text-3xl font-black text-slate-900 mb-8 tracking-tight italic underline decoration-blue-500 underline-offset-8 text-center">Visualizing the Registry Logic</h2>
|
|
83
|
+
<div class="bg-slate-900 rounded-[3rem] p-4 shadow-2xl relative overflow-hidden group">
|
|
84
|
+
<img src="triple_identity_registry.png" alt="Triple-Identity Registry Diagram" class="w-full h-auto rounded-[2.5rem] cursor-zoom-in transition-transform duration-500 hover:scale-[1.02]" onclick="openLightbox(this.src)">
|
|
85
|
+
<div class="p-8 text-white">
|
|
86
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-10">
|
|
87
|
+
<div class="p-6 bg-white/5 rounded-2xl border border-white/10 italic">
|
|
88
|
+
<h4 class="text-blue-400 font-bold mb-3 flex items-center">
|
|
89
|
+
<span class="w-2 h-2 rounded-full bg-blue-400 mr-2"></span>
|
|
90
|
+
Scenario A: Isolated Branch
|
|
91
|
+
</h4>
|
|
92
|
+
<p class="text-sm text-slate-400 leading-relaxed italic">
|
|
93
|
+
A <strong>Branch Manager</strong> (ID Layer) presents a token. The <strong>Triple-Identity Mapping Engine</strong> maps them to a single Opaque UUID. The logic strictly routes their connection to the <strong>USA Silo</strong> only. No other silos are visible or reachable.
|
|
94
|
+
</p>
|
|
95
|
+
</div>
|
|
96
|
+
<div class="p-6 bg-white/5 rounded-2xl border border-white/10 italic">
|
|
97
|
+
<h4 class="text-indigo-400 font-bold mb-3 flex items-center">
|
|
98
|
+
<span class="w-2 h-2 rounded-full bg-indigo-400 mr-2"></span>
|
|
99
|
+
Scenario B: Federated Harvester
|
|
100
|
+
</h4>
|
|
101
|
+
<p class="text-sm text-slate-400 leading-relaxed italic">
|
|
102
|
+
A <strong>Global Admin</strong> (ID Layer) initiates a query with <code>?federated=true</code>. The Mapping Engine validates their authority and fan-outs the request across <strong>USA, UK, and DE Silos</strong> simultaneously, harvesting and aggregating the collective state.
|
|
103
|
+
</p>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
</section>
|
|
109
|
+
|
|
110
|
+
<!-- TRIPLE-IDENTITY REGISTRY STEPPER -->
|
|
111
|
+
<section class="mb-20">
|
|
112
|
+
<h2 class="text-3xl font-black text-slate-900 mb-8 tracking-tight">The Mapping Decoupling</h2>
|
|
113
|
+
<p class="text-slate-600 mb-8 leading-relaxed">
|
|
114
|
+
GO-DUCK solves the "ID Enumeration" problem using an internal 3-layer mapping engine. This ensures that no internal database connection strings or IDs are ever exposed to the client.
|
|
115
|
+
</p>
|
|
116
|
+
|
|
117
|
+
<div class="bg-white border border-slate-200 rounded-[2.5rem] p-12 shadow-inner">
|
|
118
|
+
<div class="grid grid-cols-1 lg:grid-cols-3 gap-12 text-center items-center">
|
|
119
|
+
<div class="space-y-4">
|
|
120
|
+
<div class="w-16 h-16 bg-blue-600 rounded-2xl flex items-center justify-center mx-auto text-white shadow-lg"><svg class="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path></svg></div>
|
|
121
|
+
<h5 class="font-black text-slate-900 uppercase text-xs tracking-widest italic">1. Role Mapping</h5>
|
|
122
|
+
<p class="text-xs text-slate-500 font-mono bg-slate-50 p-2 rounded">realm_role: 'branch_usa'</p>
|
|
123
|
+
</div>
|
|
124
|
+
<div class="hidden lg:block"><svg class="w-8 h-8 text-slate-300 mx-auto" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7l5 5-5 5M6 7l5 5-5 5"></path></svg></div>
|
|
125
|
+
<div class="space-y-4">
|
|
126
|
+
<div class="w-16 h-16 bg-indigo-600 rounded-2xl flex items-center justify-center mx-auto text-white shadow-lg"><svg class="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"></path></svg></div>
|
|
127
|
+
<h5 class="font-black text-slate-900 uppercase text-xs tracking-widest italic">2. Opaque Proxy</h5>
|
|
128
|
+
<p class="text-xs text-slate-500 font-mono bg-slate-50 p-2 rounded">UUID: 'bc72-...-a180'</p>
|
|
129
|
+
</div>
|
|
130
|
+
<div class="hidden lg:block"><svg class="w-8 h-8 text-slate-300 mx-auto" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7l5 5-5 5M6 7l5 5-5 5"></path></svg></div>
|
|
131
|
+
<div class="space-y-4">
|
|
132
|
+
<div class="w-16 h-16 bg-emerald-600 rounded-2xl flex items-center justify-center mx-auto text-white shadow-lg"><svg class="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 7v10c0 1.1.9 2 2 2h12a2 2 0 002-2V7M4 7a2 2 0 012-2h12a2 2 0 012 2M4 7l8-4 8 4"></path></svg></div>
|
|
133
|
+
<h5 class="font-black text-slate-900 uppercase text-xs tracking-widest italic">3. Silo Routing</h5>
|
|
134
|
+
<p class="text-xs text-slate-500 font-mono bg-slate-50 p-2 rounded">DB: 'car_dealership_usa'</p>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
</section>
|
|
139
|
+
|
|
140
|
+
<!-- RUNTIME PROVISIONING: THE CONTROL PLANE -->
|
|
141
|
+
<section class="mb-20">
|
|
142
|
+
<h2 class="text-3xl font-black text-slate-900 mb-8 tracking-tight italic underline decoration-blue-500 underline-offset-8">The Control Plane: Runtime Provisioning</h2>
|
|
143
|
+
<div class="grid grid-cols-1 lg:grid-cols-2 gap-10">
|
|
144
|
+
<div class="p-10 bg-slate-900 rounded-[3rem] text-white shadow-2xl relative overflow-hidden group">
|
|
145
|
+
<div class="relative z-10">
|
|
146
|
+
<h3 class="text-2xl font-bold mb-4 text-emerald-400">Zero-Touch Onboarding</h3>
|
|
147
|
+
<p class="text-slate-400 text-sm leading-relaxed mb-6 italic">
|
|
148
|
+
GO-DUCK isn't just a static mapping. It includes a built-in <strong>SaaS Management Engine</strong> that can provision entire DB silos on the fly.
|
|
149
|
+
</p>
|
|
150
|
+
<div class="space-y-3">
|
|
151
|
+
<div class="flex items-center text-xs text-emerald-300 font-mono">
|
|
152
|
+
<span class="w-1.5 h-1.5 rounded-full bg-emerald-500 mr-2"></span>
|
|
153
|
+
POST /api/mgmt/database
|
|
154
|
+
</div>
|
|
155
|
+
<p class="text-xs text-slate-500 italic max-w-xs">Triggering this endpoint creates the DB, registers the UUID mapping, and runs schema migrations in one atomic action.</p>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<div class="p-10 bg-slate-50 border border-slate-200 rounded-[3rem] shadow-sm italic hover:bg-white transition-all">
|
|
161
|
+
<h3 class="text-xl font-bold text-slate-900 mb-4">Lazy Connection Management</h3>
|
|
162
|
+
<p class="text-slate-600 text-sm leading-relaxed mb-4">
|
|
163
|
+
To maintain elite performance, silos are <strong>Lazily Hydrated</strong>. Connection pools are only initialized upon the first incoming request for that Silo.
|
|
164
|
+
</p>
|
|
165
|
+
<div class="p-4 bg-white rounded-2xl border border-slate-200 text-xs font-mono text-blue-800">
|
|
166
|
+
// Internal Registry Logic<br>
|
|
167
|
+
if pool := registry.Find(siloID); pool == nil {<br>
|
|
168
|
+
registry.Hydrate(siloID); // Lazy Init<br>
|
|
169
|
+
}
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
</section>
|
|
174
|
+
|
|
175
|
+
<!-- PRECISION HARVESTING -->
|
|
176
|
+
<section class="mb-20">
|
|
177
|
+
<h2 class="text-3xl font-black text-slate-900 mb-8 tracking-tight italic underline decoration-indigo-500 underline-offset-8 text-right px-4">Precision Global Harvesting</h2>
|
|
178
|
+
<div class="p-12 bg-white border border-slate-200 rounded-[3rem] shadow-sm relative overflow-hidden group">
|
|
179
|
+
<div class="flex flex-col md:flex-row gap-12 items-start">
|
|
180
|
+
<div class="flex-grow">
|
|
181
|
+
<h3 class="text-2xl font-bold mb-4 text-slate-900 italic">Surgical Silo Selection</h3>
|
|
182
|
+
<p class="text-slate-600 mb-8 leading-relaxed max-w-2xl italic">
|
|
183
|
+
What if a user has access to <strong>10 different silos</strong> but only needs to reconcile data from <strong>3 specific regions</strong>?
|
|
184
|
+
GO-DUCK supports <strong>Precision Harvesting</strong> via the <code>X-Tenant-ID</code> header and the <code>?federated=true</code> parameter.
|
|
185
|
+
</p>
|
|
186
|
+
<div class="space-y-4">
|
|
187
|
+
<div class="flex items-start gap-4">
|
|
188
|
+
<div class="p-2 bg-indigo-50 rounded-lg text-indigo-600 font-bold text-xs">HEADER</div>
|
|
189
|
+
<code class="text-sm text-indigo-900 font-black tracking-widest whitespace-normal break-all">X-Tenant-ID: uuid-1, uuid-2, uuid-3</code>
|
|
190
|
+
</div>
|
|
191
|
+
<p class="text-xs text-slate-400 font-medium italic">The Parallel Harvester 2.0 detects the comma-separated list and reduces its concurrent fan-out to ONLY the intersected set of authorized silos.</p>
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
<div class="w-full md:w-1/3 bg-slate-900 rounded-2xl p-6 text-emerald-400 font-mono text-xs leading-relaxed">
|
|
195
|
+
<span class="text-slate-500">// Harvester Logic</span><br>
|
|
196
|
+
authorized := user.GetSilos()<br>
|
|
197
|
+
requested := header.GetTenants()<br>
|
|
198
|
+
target := intersect(authorized, requested)<br>
|
|
199
|
+
<br>
|
|
200
|
+
<span class="text-slate-500">// Fan-out only to target</span><br>
|
|
201
|
+
for silo := range target {<br>
|
|
202
|
+
go harvest(silo)<br>
|
|
203
|
+
}
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
</section>
|
|
208
|
+
|
|
209
|
+
<!-- PRECISION API REFERENCE -->
|
|
210
|
+
<section class="mb-16">
|
|
211
|
+
<h2 class="text-3xl font-black text-slate-900 mb-8 tracking-tight text-center italic uppercase tracking-widest">Federated API Guide</h2>
|
|
212
|
+
<div class="overflow-x-auto rounded-[2rem] border border-slate-200 shadow-xl">
|
|
213
|
+
<table class="min-w-full divide-y divide-slate-200">
|
|
214
|
+
<thead class="bg-slate-50">
|
|
215
|
+
<tr>
|
|
216
|
+
<th class="px-6 py-4 text-left text-xs font-black text-slate-500 uppercase tracking-widest">Action Type</th>
|
|
217
|
+
<th class="px-6 py-4 text-left text-xs font-black text-slate-500 uppercase tracking-widest">Header / Params</th>
|
|
218
|
+
<th class="px-6 py-4 text-left text-xs font-black text-slate-500 uppercase tracking-widest">Resulting Behavior</th>
|
|
219
|
+
</tr>
|
|
220
|
+
</thead>
|
|
221
|
+
<tbody class="bg-white divide-y divide-slate-100 italic font-medium">
|
|
222
|
+
<tr><td class="px-6 py-4 font-bold text-slate-900">Standard Action</td><td class="px-6 py-4 font-mono text-slate-400 font-bold italic">(None)</td><td class="px-6 py-4 text-sm text-blue-600">Dynamic routing to your assigned localized Silo.</td></tr>
|
|
223
|
+
<tr class="bg-blue-50/30"><td class="px-6 py-4 font-bold text-slate-900">Silo Narrowing</td><td class="px-6 py-4 font-mono text-indigo-600 font-bold italic">X-Tenant-ID: {UUID}</td><td class="px-6 py-4 text-sm text-slate-600">Force focus on a specific regional database silo.</td></tr>
|
|
224
|
+
<tr class="bg-indigo-50/30"><td class="px-6 py-4 font-bold text-slate-900">Global Harvest</td><td class="px-6 py-4 font-mono text-indigo-600 font-bold italic">?federated=true</td><td class="px-6 py-4 text-sm text-indigo-800">Aggregates results from ALL silos in a single response.</td></tr>
|
|
225
|
+
<tr><td class="px-6 py-4 font-bold text-slate-900">Atomic Broadcast</td><td class="px-6 py-4 font-mono text-indigo-600 font-bold italic">X-Broadcast: true</td><td class="px-6 py-4 text-sm text-slate-600">Writes to Lead-Silo and pushes to all others via Saga Outbox.</td></tr>
|
|
226
|
+
</tbody>
|
|
227
|
+
</table>
|
|
228
|
+
</div>
|
|
229
|
+
</section>
|
|
230
|
+
|
|
231
|
+
<!-- FOOTER CTA -->
|
|
232
|
+
<div class="p-10 bg-slate-900 rounded-[3rem] text-center text-white shadow-2xl relative overflow-hidden">
|
|
233
|
+
<div class="absolute top-0 left-0 w-full h-full bg-gradient-to-br from-indigo-600/20 to-transparent"></div>
|
|
234
|
+
<h3 class="text-3xl font-black mb-4 tracking-tight relative z-10">Scale Without Data Leakage</h3>
|
|
235
|
+
<p class="text-slate-400 mb-8 max-w-2xl mx-auto italic relative z-10">Entities marked with <code>@Federated</code> automatically participate in this multi-silo orchestrator. Start your creation process today.</p>
|
|
236
|
+
<a href="index.html" class="relative z-10 inline-flex items-center px-8 py-4 bg-blue-600 text-white font-black rounded-full hover:bg-blue-700 transition-all shadow-xl hover:scale-105 active:scale-95">
|
|
237
|
+
Back to Quick Start
|
|
238
|
+
<svg class="w-5 h-5 ml-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7l5 5-5 5M6 7l5 5-5 5"></path></svg>
|
|
239
|
+
</a>
|
|
240
|
+
</div>
|
|
241
|
+
</div>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<div class="prose prose-slate max-w-none">
|
|
2
|
+
<!-- Advanced 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="M11 5.882V19.24a1.76 1.76 0 01-3.417.592l-2.147-6.15M18 13a3 3 0 100-6M5.436 13.683A4.001 4.001 0 017 6h1.832c4.1 0 7.625-1.234 9.168-3v14c-1.543-1.766-5.067-3-9.168-3H7a3.988 3.988 0 01-1.564-.317z" />
|
|
7
|
+
</svg>
|
|
8
|
+
</div>
|
|
9
|
+
<div>
|
|
10
|
+
<h1 class="text-4xl font-black text-slate-900 m-0 tracking-tight leading-none">Advanced Topics</h1>
|
|
11
|
+
<p class="text-indigo-600 font-bold tracking-widest uppercase text-[10px] mt-2 ml-1">Enums, Security & Public APIs</p>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<p class="text-xl text-slate-600 mb-12 italic leading-relaxed">
|
|
16
|
+
Beyond core data modeling, GDL provides the tools to define typed constants and fine-tune the granular security of your API endpoints.
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<!-- ENUMS SECTION -->
|
|
20
|
+
<section class="mb-20">
|
|
21
|
+
<h2 class="text-3xl font-black text-slate-900 mb-8 tracking-tight italic">The Typed Truth: Enums</h2>
|
|
22
|
+
<p class="text-slate-600 mb-8 leading-relaxed">Enums (Enumerated Types) allow you to define a fixed set of allowed values for a field. GDL enums are high-fidelity, generating Go string-enums, Protobuf enums, and GraphQL enums simultaneously.</p>
|
|
23
|
+
|
|
24
|
+
<div class="bg-slate-50 p-8 rounded-[2.5rem] border border-slate-200">
|
|
25
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-8">
|
|
26
|
+
<div class="bg-white p-6 rounded-2xl shadow-sm border border-slate-100">
|
|
27
|
+
<span class="text-[10px] font-bold text-slate-400 uppercase tracking-widest block mb-4 font-mono">GDL Definition</span>
|
|
28
|
+
<pre class="text-indigo-700 font-mono text-sm leading-relaxed whitespace-pre font-bold">
|
|
29
|
+
enum OrderStatus {
|
|
30
|
+
PENDING,
|
|
31
|
+
SHIPPED,
|
|
32
|
+
DELIVERED,
|
|
33
|
+
CANCELLED
|
|
34
|
+
}
|
|
35
|
+
</pre>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="bg-indigo-900 p-6 rounded-2xl shadow-sm">
|
|
38
|
+
<span class="text-[10px] font-bold text-indigo-400 uppercase tracking-widest block mb-4 font-mono">Usage in Entity</span>
|
|
39
|
+
<pre class="text-white font-mono text-sm leading-relaxed whitespace-pre italic">
|
|
40
|
+
entity Order {
|
|
41
|
+
OrderStatus status required
|
|
42
|
+
datetime orderDate
|
|
43
|
+
}
|
|
44
|
+
</pre>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</section>
|
|
49
|
+
|
|
50
|
+
<!-- PUBLIC API SECTION -->
|
|
51
|
+
<section class="mb-20">
|
|
52
|
+
<h2 class="text-3xl font-black text-slate-900 mb-8 tracking-tight italic underline decoration-indigo-500 underline-offset-8">Public / Open Entities</h2>
|
|
53
|
+
<p class="text-slate-600 mb-8 leading-relaxed">By default, all GO-DUCK endpoints require a valid Keycloak JWT. The `open` keyword allows you to selectively disable authentication for specific entities with action-level granularity.</p>
|
|
54
|
+
|
|
55
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-12">
|
|
56
|
+
<div class="p-8 bg-white border border-slate-200 rounded-3xl group hover:border-indigo-200 transition-colors shadow-sm">
|
|
57
|
+
<code class="text-indigo-700 font-mono font-black text-lg block mb-4">open EntityName</code>
|
|
58
|
+
<p class="text-sm text-slate-600 leading-relaxed mb-0">Disables authentication for <strong>ALL</strong> actions (Read, Create, Update, Delete) on the entity. <strong>Caution: Use with care!</strong></p>
|
|
59
|
+
</div>
|
|
60
|
+
<div class="p-8 bg-white border border-slate-200 rounded-3xl group hover:border-indigo-200 transition-colors shadow-sm">
|
|
61
|
+
<code class="text-indigo-700 font-mono font-black text-lg block mb-4">open Entity(read, create)</code>
|
|
62
|
+
<p class="text-sm text-slate-600 leading-relaxed mb-0">Surgical precision. For example, allowing public <strong>read</strong> and <strong>create</strong> while requiring admin JWT for updates/deletes.</p>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<div class="bg-indigo-950 p-8 rounded-3xl shadow-xl shadow-indigo-100 text-indigo-200 text-sm font-mono leading-relaxed border-t-8 border-t-indigo-600">
|
|
67
|
+
<span class="text-indigo-500 font-bold block mb-4">// Complete GDL Schema Fragment</span>
|
|
68
|
+
<span class="text-white">enum</span> <span class="text-indigo-400">ArticleStatus</span> { PUBLISHED, DRAFT }<br/><br/>
|
|
69
|
+
|
|
70
|
+
<span class="text-white">entity</span> <span class="text-indigo-400">Article</span> {<br/>
|
|
71
|
+
string(255) title required<br/>
|
|
72
|
+
text content<br/>
|
|
73
|
+
ArticleStatus status<br/>
|
|
74
|
+
}<br/><br/>
|
|
75
|
+
|
|
76
|
+
<span class="text-slate-500">// Allow public reading of articles, but require JWT for mutations</span><br/>
|
|
77
|
+
<span class="text-indigo-400 font-bold">open Article(read)</span>
|
|
78
|
+
</div>
|
|
79
|
+
</section>
|
|
80
|
+
|
|
81
|
+
<!-- FOOTER NAV -->
|
|
82
|
+
<div class="flex flex-col md:flex-row gap-4 mb-20">
|
|
83
|
+
<a href="cli.html" class="flex-1 p-6 bg-slate-900 rounded-2xl text-white hover:bg-slate-800 transition-colors group">
|
|
84
|
+
<div class="text-xs font-bold text-slate-500 uppercase tracking-widest mb-2">Back to Reference</div>
|
|
85
|
+
<div class="text-xl font-bold flex items-center">
|
|
86
|
+
CLI Usage
|
|
87
|
+
<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>
|
|
88
|
+
</div>
|
|
89
|
+
</a>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<div class="prose prose-slate max-w-none">
|
|
2
|
+
<!-- Annotations Hero -->
|
|
3
|
+
<div class="flex items-center space-x-3 mb-10 text-orange-700">
|
|
4
|
+
<div class="p-4 bg-gradient-to-br from-orange-600 to-orange-800 rounded-3xl shadow-xl shadow-orange-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="M11 4a2 2 0 114 0v1a2 2 0 002 2h3a2 2 0 012 2v3a2 2 0 002 2h1a2 2 0 110 4h-1a2 2 0 00-2 2v3a2 2 0 01-2 2h-3a2 2 0 00-2 2v1a2 2 0 11-4 0v-1a2 2 0 00-2-2H7a2 2 0 01-2-2v-3a2 2 0 00-2-2H4a2 2 0 110-4h1a2 2 0 002-2V7a2 2 0 012-2h3a2 2 0 002-2V4z" />
|
|
7
|
+
</svg>
|
|
8
|
+
</div>
|
|
9
|
+
<div>
|
|
10
|
+
<h1 class="text-4xl font-black text-slate-900 m-0 tracking-tight leading-none">Power-up Annotations</h1>
|
|
11
|
+
<p class="text-orange-600 font-bold tracking-widest uppercase text-[10px] mt-2 ml-1">Behavioral Extensions & Plugins</p>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<p class="text-xl text-slate-600 mb-12 italic border-l-4 border-orange-500 pl-6 leading-relaxed">
|
|
16
|
+
Annotations are the "Secret Sauce" of GO-DUCK. By marking an entity with an annotation, you inject sophisticated distributed logic that would otherwise require hundreds of lines of manual code.
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<!-- THE POWER-UPS GRID -->
|
|
20
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-20">
|
|
21
|
+
<!-- @Federated -->
|
|
22
|
+
<div class="p-10 bg-blue-50 border border-blue-100 rounded-[3rem] shadow-sm transition-all duration-300 hover:shadow-blue-200 group">
|
|
23
|
+
<div class="flex items-center justify-between mb-8">
|
|
24
|
+
<code class="text-blue-700 font-mono font-black text-2xl group-hover:scale-105 transition-transform">@Federated</code>
|
|
25
|
+
<div class="w-12 h-12 bg-white rounded-2xl flex items-center justify-center text-2xl shadow-sm">🌐</div>
|
|
26
|
+
</div>
|
|
27
|
+
<h4 class="text-lg font-black text-slate-900 mb-4 m-0 uppercase tracking-tighter">Multi-Silo Core</h4>
|
|
28
|
+
<p class="text-sm text-slate-700 leading-relaxed m-0 italic mb-6">Enables the <strong>Precision Harvester 2.0</strong>. The entity becomes cross-silo aware, supporting parallel read aggregations and atomic multi-broadcast writes via the Federated Router.</p>
|
|
29
|
+
<div class="p-4 bg-white/50 rounded-2xl border border-blue-200 border-dashed">
|
|
30
|
+
<span class="text-[10px] font-bold text-blue-400 uppercase tracking-widest block mb-2 font-mono">Architectural Impact</span>
|
|
31
|
+
<p class="text-[11px] text-blue-900 m-0 font-medium font-mono leading-tight">Injects Silo-Discovery interceptors & Atomic Mutex locks on write ops.</p>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<!-- @Searchable -->
|
|
36
|
+
<div class="p-10 bg-orange-50 border border-orange-100 rounded-[3rem] shadow-sm transition-all duration-300 hover:shadow-orange-200 group">
|
|
37
|
+
<div class="flex items-center justify-between mb-8">
|
|
38
|
+
<code class="text-orange-700 font-mono font-black text-2xl group-hover:scale-105 transition-transform">@Searchable</code>
|
|
39
|
+
<div class="w-12 h-12 bg-white rounded-2xl flex items-center justify-center text-2xl shadow-sm">⚡</div>
|
|
40
|
+
</div>
|
|
41
|
+
<h4 class="text-lg font-black text-slate-900 mb-4 m-0 uppercase tracking-tighter">Elasticsearch Sync</h4>
|
|
42
|
+
<p class="text-sm text-slate-700 leading-relaxed m-0 italic mb-6">Triggers real-time indexing into Elasticsearch. Every mutation (Create/Update/Delete) is automatically mirrored to the ES engine.</p>
|
|
43
|
+
<div class="p-4 bg-white/50 rounded-2xl border border-orange-200 border-dashed">
|
|
44
|
+
<span class="text-[10px] font-bold text-orange-400 uppercase tracking-widest block mb-2 font-mono">Architectural Impact</span>
|
|
45
|
+
<p class="text-[11px] text-orange-900 m-0 font-medium font-mono leading-tight">Registers GORM AfterSave hooks & scaffolds /api/search/:entity endpoints.</p>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<!-- @Audited -->
|
|
50
|
+
<div class="p-10 bg-purple-50 border border-purple-100 rounded-[3rem] shadow-sm transition-all duration-300 hover:shadow-purple-200 group">
|
|
51
|
+
<div class="flex items-center justify-between mb-8">
|
|
52
|
+
<code class="text-purple-700 font-mono font-black text-2xl group-hover:scale-105 transition-transform">@Audited</code>
|
|
53
|
+
<div class="w-12 h-12 bg-white rounded-2xl flex items-center justify-center text-2xl shadow-sm">📜</div>
|
|
54
|
+
</div>
|
|
55
|
+
<h4 class="text-lg font-black text-slate-900 mb-4 m-0 uppercase tracking-tighter">Zero-Trust Logging</h4>
|
|
56
|
+
<p class="text-sm text-slate-700 leading-relaxed m-0 italic mb-6">Enables deep regulatory auditing. Every row change is logged to the central `audit_log` table with Keycloak identity, client IP, and realm roles.</p>
|
|
57
|
+
<div class="p-4 bg-white/50 rounded-2xl border border-purple-200 border-dashed">
|
|
58
|
+
<span class="text-[10px] font-bold text-purple-400 uppercase tracking-widest block mb-2 font-mono">Architectural Impact</span>
|
|
59
|
+
<p class="text-[11px] text-purple-900 m-0 font-medium font-mono leading-tight">Injects AuditContext midddleware & historical row-version snapshotting.</p>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<!-- @Version -->
|
|
64
|
+
<div class="p-10 bg-amber-50 border border-amber-100 rounded-[3rem] shadow-sm transition-all duration-300 hover:shadow-amber-200 group">
|
|
65
|
+
<div class="flex items-center justify-between mb-8">
|
|
66
|
+
<code class="text-amber-700 font-mono font-black text-2xl group-hover:scale-105 transition-transform">@Version</code>
|
|
67
|
+
<div class="w-12 h-12 bg-white rounded-2xl flex items-center justify-center text-2xl shadow-sm">🔒</div>
|
|
68
|
+
</div>
|
|
69
|
+
<h4 class="text-lg font-black text-slate-900 mb-4 m-0 uppercase tracking-tighter">Optimistic Locking</h4>
|
|
70
|
+
<p class="text-sm text-slate-700 leading-relaxed m-0 italic mb-6">Implicitly adds a `version` field. GORM automatically rejects updates (HTTP 409) if the version has changed since the data was fetched.</p>
|
|
71
|
+
<div class="p-4 bg-white/50 rounded-2xl border border-amber-200 border-dashed">
|
|
72
|
+
<span class="text-[10px] font-bold text-amber-400 uppercase tracking-widest block mb-2 font-mono">Architectural Impact</span>
|
|
73
|
+
<p class="text-[11px] text-amber-900 m-0 font-medium font-mono leading-tight">Injects GORM Optimistic Locking plugin & atomic integer increments.</p>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<!-- open Security Rule -->
|
|
78
|
+
<div class="p-10 bg-indigo-50 border border-indigo-100 rounded-[3rem] shadow-sm transition-all duration-300 hover:shadow-indigo-200 group relative overflow-hidden">
|
|
79
|
+
<div class="absolute top-0 right-0 p-6 opacity-[0.03] group-hover:opacity-[0.07] transition-opacity">
|
|
80
|
+
<svg class="w-32 h-32 text-indigo-900" fill="currentColor" viewBox="0 0 20 20"><path d="M10 2a5 5 0 00-5 5v2a2 2 0 00-2 2v5a2 2 0 002 2h10a2 2 0 002-2v-5a2 2 0 00-2-2H15V7a5 5 0 00-5-5zM8 7a2 2 0 114 0v2H8V7z"></path></svg>
|
|
81
|
+
</div>
|
|
82
|
+
<div class="flex items-center justify-between mb-8">
|
|
83
|
+
<code class="text-indigo-700 font-mono font-black text-2xl group-hover:scale-105 transition-transform">open</code>
|
|
84
|
+
<div class="w-12 h-12 bg-white rounded-2xl flex items-center justify-center text-2xl shadow-sm">🔓</div>
|
|
85
|
+
</div>
|
|
86
|
+
<h4 class="text-lg font-black text-slate-900 mb-4 m-0 uppercase tracking-tighter">Public API Access</h4>
|
|
87
|
+
<p class="text-sm text-slate-700 leading-relaxed m-0 italic mb-6">Selectively bypasses the Keycloak JWT stack. This allows you to expose specific entities or <strong>granular actions</strong> to the public internet without authentication headers.</p>
|
|
88
|
+
|
|
89
|
+
<div class="space-y-4 mb-8">
|
|
90
|
+
<p class="text-[10px] font-black text-indigo-400 uppercase tracking-widest italic">Supported Method Granularity</p>
|
|
91
|
+
<div class="grid grid-cols-2 gap-2">
|
|
92
|
+
<div class="px-3 py-1 bg-white border border-indigo-100 rounded-lg text-[10px] font-bold text-slate-600 flex items-center gap-2"><span class="w-1.5 h-1.5 bg-emerald-400 rounded-full"></span>read</div>
|
|
93
|
+
<div class="px-3 py-1 bg-white border border-indigo-100 rounded-lg text-[10px] font-bold text-slate-600 flex items-center gap-2"><span class="w-1.5 h-1.5 bg-emerald-400 rounded-full"></span>list</div>
|
|
94
|
+
<div class="px-3 py-1 bg-white border border-indigo-100 rounded-lg text-[10px] font-bold text-slate-600 flex items-center gap-2"><span class="w-1.5 h-1.5 bg-amber-400 rounded-full"></span>create</div>
|
|
95
|
+
<div class="px-3 py-1 bg-white border border-indigo-100 rounded-lg text-[10px] font-bold text-slate-600 flex items-center gap-2"><span class="w-1.5 h-1.5 bg-rose-400 rounded-full"></span>delete</div>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
<div class="p-4 bg-white/50 rounded-2xl border border-indigo-200 border-dashed">
|
|
100
|
+
<p class="text-[11px] text-indigo-900 m-0 font-medium font-mono leading-tight">Architectural Impact: Scaffolds routes into the <code class="text-indigo-600 text-[10px]">/api/open/*</code> group, bypassing the OIDC Validator middleware chain.</p>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<!-- COMPLEX EXAMPLE -->
|
|
106
|
+
<div class="bg-slate-900 rounded-[3rem] p-12 text-white shadow-2xl relative overflow-hidden group mb-16">
|
|
107
|
+
<div class="absolute inset-0 bg-gradient-to-br from-orange-900/40 to-transparent"></div>
|
|
108
|
+
<div class="relative z-10">
|
|
109
|
+
<h2 class="text-3xl font-black mb-6 leading-tight m-0">The Complete Power-Up Stack</h2>
|
|
110
|
+
<div class="bg-slate-800/80 rounded-3xl p-8 border border-white/10 shadow-lg backdrop-blur-md">
|
|
111
|
+
<pre class="text-orange-300 font-mono text-base leading-relaxed overflow-x-auto m-0 selection:bg-orange-500/30">
|
|
112
|
+
<span class="text-slate-500">// Entities can combine any number of power-ups</span>
|
|
113
|
+
@Searchable @Audited @Federated
|
|
114
|
+
entity Transaction {
|
|
115
|
+
string(100) ref required unique
|
|
116
|
+
bigdecimal amount
|
|
117
|
+
datetime txDate
|
|
118
|
+
@Version int(32) v
|
|
119
|
+
}
|
|
120
|
+
</pre>
|
|
121
|
+
</div>
|
|
122
|
+
<p class="mt-8 text-slate-400 text-xs italic font-medium leading-relaxed m-0 border-l border-slate-700 pl-6">
|
|
123
|
+
Combining all three creates a globally synchronized, audited, and searchable entity with zero-trust integrity.
|
|
124
|
+
</p>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
<div class="flex flex-col md:flex-row gap-4 mb-20">
|
|
129
|
+
<a href="gdl-advanced.html" class="flex-1 p-6 bg-slate-900 rounded-2xl text-white hover:bg-slate-800 transition-colors group">
|
|
130
|
+
<div class="text-xs font-bold text-slate-500 uppercase tracking-widest mb-2">Next Category</div>
|
|
131
|
+
<div class="text-xl font-bold flex items-center">
|
|
132
|
+
🔮 Advanced Topics
|
|
133
|
+
<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>
|
|
134
|
+
</div>
|
|
135
|
+
</a>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
<div class="prose prose-slate max-w-none">
|
|
2
|
+
<!-- Entities Hero -->
|
|
3
|
+
<div class="flex items-center space-x-3 mb-10 text-emerald-700">
|
|
4
|
+
<div class="p-4 bg-gradient-to-br from-emerald-600 to-emerald-800 rounded-3xl shadow-xl shadow-emerald-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="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" />
|
|
7
|
+
</svg>
|
|
8
|
+
</div>
|
|
9
|
+
<div>
|
|
10
|
+
<h1 class="text-4xl font-black text-slate-900 m-0 tracking-tight leading-none">Entities & Fields</h1>
|
|
11
|
+
<p class="text-emerald-600 font-bold tracking-widest uppercase text-[10px] mt-2 ml-1">Data Modeling & Type System</p>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<p class="text-xl text-slate-600 mb-12 italic leading-relaxed">
|
|
16
|
+
Entities represent the core data structures of your microservice. Each entity is mapped to a GORM model, a Protobuf message, and a PostgreSQL table.
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<!-- Syntax Guide -->
|
|
20
|
+
<div class="bg-slate-50 p-10 rounded-[3rem] border border-slate-200 mb-20 shadow-sm">
|
|
21
|
+
<h2 class="text-2xl font-black text-slate-900 mb-6 m-0">The Declaration Syntax</h2>
|
|
22
|
+
<p class="text-slate-600 mb-6">GDL supports two declaration styles for flexibility, though the <strong>Type-First</strong> approach is the modern standard for elite developers.</p>
|
|
23
|
+
|
|
24
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 items-start">
|
|
25
|
+
<div class="bg-white p-6 rounded-2xl border border-slate-200 shadow-sm border-t-4 border-t-emerald-500">
|
|
26
|
+
<span class="text-xs font-bold text-slate-400 uppercase tracking-widest mb-2 block">Modern Style (Type-First)</span>
|
|
27
|
+
<pre class="bg-transparent p-0 text-emerald-700 font-mono text-sm leading-relaxed whitespace-pre font-bold">
|
|
28
|
+
string(100) fullName required
|
|
29
|
+
datetime lastLogin
|
|
30
|
+
jsonb metadata
|
|
31
|
+
</pre>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="bg-white p-6 rounded-2xl border border-slate-200 shadow-sm border-l-4 border-l-slate-300">
|
|
34
|
+
<span class="text-xs font-bold text-slate-400 uppercase tracking-widest mb-2 block">Classic Style (Field-First)</span>
|
|
35
|
+
<pre class="bg-transparent p-0 text-slate-600 font-mono text-sm leading-relaxed whitespace-pre italic">
|
|
36
|
+
fullName String required
|
|
37
|
+
lastLogin DateTime
|
|
38
|
+
metadata JSONB
|
|
39
|
+
</pre>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<!-- ELITE TYPE REFERENCE -->
|
|
45
|
+
<section class="mb-20">
|
|
46
|
+
<h2 class="text-3xl font-black text-slate-900 mb-8 tracking-tight underline decoration-emerald-500 underline-offset-8">Global Type System Reference</h2>
|
|
47
|
+
<div class="overflow-x-auto rounded-[2.5rem] border border-slate-200 shadow-sm border-t-8 border-t-emerald-600">
|
|
48
|
+
<table class="min-w-full divide-y divide-slate-200 m-0">
|
|
49
|
+
<thead class="bg-emerald-50 text-emerald-900">
|
|
50
|
+
<tr>
|
|
51
|
+
<th class="px-6 py-5 text-left text-xs font-black uppercase tracking-[0.2em]">GDL Type</th>
|
|
52
|
+
<th class="px-6 py-5 text-left text-xs font-black uppercase tracking-[0.2em]">Go Native</th>
|
|
53
|
+
<th class="px-6 py-5 text-left text-xs font-black uppercase tracking-[0.2em]">SQL (Postgres)</th>
|
|
54
|
+
</tr>
|
|
55
|
+
</thead>
|
|
56
|
+
<tbody class="bg-white divide-y divide-slate-100 text-sm font-medium italic">
|
|
57
|
+
<tr class="hover:bg-emerald-50/30 transition-colors">
|
|
58
|
+
<td class="px-6 py-4 font-mono font-bold text-emerald-700">string(N)</td>
|
|
59
|
+
<td class="px-6 py-4 font-mono text-slate-400">string</td>
|
|
60
|
+
<td class="px-6 py-4 font-mono text-slate-400">VARCHAR(N)</td>
|
|
61
|
+
</tr>
|
|
62
|
+
<tr class="hover:bg-emerald-50/30 transition-colors">
|
|
63
|
+
<td class="px-6 py-4 font-mono font-bold text-emerald-700">text</td>
|
|
64
|
+
<td class="px-6 py-4 font-mono text-slate-400">string</td>
|
|
65
|
+
<td class="px-6 py-4 font-mono text-slate-400">TEXT</td>
|
|
66
|
+
</tr>
|
|
67
|
+
<tr class="hover:bg-emerald-50/30 transition-colors">
|
|
68
|
+
<td class="px-6 py-4 font-mono font-bold text-emerald-700">int / integer</td>
|
|
69
|
+
<td class="px-6 py-4 font-mono text-slate-400">int</td>
|
|
70
|
+
<td class="px-6 py-4 font-mono text-slate-400">INTEGER</td>
|
|
71
|
+
</tr>
|
|
72
|
+
<tr class="hover:bg-emerald-50/30 transition-colors">
|
|
73
|
+
<td class="px-6 py-4 font-mono font-bold text-emerald-700">long</td>
|
|
74
|
+
<td class="px-6 py-4 font-mono text-slate-400">int64</td>
|
|
75
|
+
<td class="px-6 py-4 font-mono text-slate-400">BIGINT</td>
|
|
76
|
+
</tr>
|
|
77
|
+
<tr class="hover:bg-emerald-50/30 transition-colors">
|
|
78
|
+
<td class="px-6 py-4 font-mono font-bold text-emerald-700">bool / boolean</td>
|
|
79
|
+
<td class="px-6 py-4 font-mono text-slate-400">bool</td>
|
|
80
|
+
<td class="px-6 py-4 font-mono text-slate-400">BOOLEAN</td>
|
|
81
|
+
</tr>
|
|
82
|
+
<tr class="hover:bg-emerald-50/30 transition-colors">
|
|
83
|
+
<td class="px-6 py-4 font-mono font-bold text-emerald-700">json / jsonb</td>
|
|
84
|
+
<td class="px-6 py-4 font-mono text-slate-400">datatypes.JSON</td>
|
|
85
|
+
<td class="px-6 py-4 font-mono text-slate-400">JSON / JSONB</td>
|
|
86
|
+
</tr>
|
|
87
|
+
<tr class="hover:bg-emerald-50/30 transition-colors">
|
|
88
|
+
<td class="px-6 py-4 font-mono font-bold text-emerald-700">datetime / instant</td>
|
|
89
|
+
<td class="px-6 py-4 font-mono text-slate-400">time.Time</td>
|
|
90
|
+
<td class="px-6 py-4 font-mono text-slate-400">TIMESTAMP</td>
|
|
91
|
+
</tr>
|
|
92
|
+
<tr class="hover:bg-emerald-50/30 transition-colors">
|
|
93
|
+
<td class="px-6 py-4 font-mono font-bold text-emerald-700">uuid</td>
|
|
94
|
+
<td class="px-6 py-4 font-mono text-slate-400">uuid.UUID</td>
|
|
95
|
+
<td class="px-6 py-4 font-mono text-slate-400">UUID</td>
|
|
96
|
+
</tr>
|
|
97
|
+
</tbody>
|
|
98
|
+
</table>
|
|
99
|
+
</div>
|
|
100
|
+
</section>
|
|
101
|
+
|
|
102
|
+
<!-- Field Modifiers -->
|
|
103
|
+
<section class="mb-20">
|
|
104
|
+
<h2 class="text-3xl font-black text-slate-900 mb-8 tracking-tight">Field Modifiers</h2>
|
|
105
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
106
|
+
<div class="p-8 bg-white border border-slate-200 rounded-3xl group hover:border-emerald-200 transition-colors shadow-sm">
|
|
107
|
+
<div class="flex items-center space-x-3 mb-4">
|
|
108
|
+
<span class="px-3 py-1 bg-emerald-100 text-emerald-700 rounded-lg text-xs font-black font-mono">required</span>
|
|
109
|
+
<span class="h-px bg-slate-100 flex-1"></span>
|
|
110
|
+
</div>
|
|
111
|
+
<h4 class="text-base font-bold text-slate-900 mb-2 m-0 group-hover:text-emerald-700 transition-colors">Strict Integrity</h4>
|
|
112
|
+
<p class="text-sm text-slate-600 m-0 leading-relaxed">Adds `NOT NULL` to the SQL schema and marks the field as required in Protobuf and Gin validation hooks.</p>
|
|
113
|
+
</div>
|
|
114
|
+
<div class="p-8 bg-white border border-slate-200 rounded-3xl group hover:border-emerald-200 transition-colors shadow-sm">
|
|
115
|
+
<div class="flex items-center space-x-3 mb-4">
|
|
116
|
+
<span class="px-3 py-1 bg-emerald-100 text-emerald-700 rounded-lg text-xs font-black font-mono">unique</span>
|
|
117
|
+
<span class="h-px bg-slate-100 flex-1"></span>
|
|
118
|
+
</div>
|
|
119
|
+
<h4 class="text-base font-bold text-slate-900 mb-2 m-0 group-hover:text-emerald-700 transition-colors">Natural Key Protection</h4>
|
|
120
|
+
<p class="text-sm text-slate-600 m-0 leading-relaxed">Automatically creates a unique index in PostgreSQL to prevent duplicate records across all silos.</p>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</section>
|
|
124
|
+
|
|
125
|
+
<div class="flex flex-col md:flex-row gap-4 mb-20">
|
|
126
|
+
<a href="gdl-relationships.html" class="flex-1 p-6 bg-slate-900 rounded-2xl text-white hover:bg-slate-800 transition-colors group">
|
|
127
|
+
<div class="text-xs font-bold text-slate-500 uppercase tracking-widest mb-2">Next Category</div>
|
|
128
|
+
<div class="text-xl font-bold flex items-center">
|
|
129
|
+
🧬 Relationships
|
|
130
|
+
<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>
|
|
131
|
+
</div>
|
|
132
|
+
</a>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|