summaryrefslogtreecommitdiff
path: root/internal/resource/embed
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-07-09 00:14:33 +0300
committerPaul Buetow <paul@buetow.org>2026-07-09 00:14:33 +0300
commit756ae621bd97a8b776fefb15e5e7e2292f98ee45 (patch)
treeb454f958e6aef70bf7ca40dcbc106323cee2a42f /internal/resource/embed
parent3f8b79f2b1384e3abc2b1bb2fe913688c7ec251c (diff)
dependencies
Diffstat (limited to 'internal/resource/embed')
-rw-r--r--internal/resource/embed/embed.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/internal/resource/embed/embed.go b/internal/resource/embed/embed.go
new file mode 100644
index 0000000..49fe3eb
--- /dev/null
+++ b/internal/resource/embed/embed.go
@@ -0,0 +1,24 @@
+package embed
+
+// DependsOn is embedded into concrete resource types to give them the ability
+// to accumulate dependency IDs supplied via the DependsOn option.
+type DependsOn struct {
+ IDs []string
+}
+
+// AddDependency records a single resource ID this resource depends on. It uses
+// a pointer receiver so the mutation is visible to the embedding value.
+func (d *DependsOn) AddDependency(id string) {
+ d.IDs = append(d.IDs, id)
+}
+
+// Absence is embedded into concrete resource types that can be marked for
+// removal via the IsAbsent option. It promotes an Absent field and a
+// SetAbsent method to the embedding type.
+type Absence struct {
+ Absent bool
+}
+
+// SetAbsent implements opt.Absentable, marking the resource for removal. It
+// uses a pointer receiver so the mutation is visible to the embedding value.
+func (a *Absence) SetAbsent() { a.Absent = true }